Commit Graph

73761 Commits

Author SHA1 Message Date
Guillaume Gomez
a809da3fee Rollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=petrochenkov
Fix into() cast paren check precedence

As discussed in #47699 the logic for determining if an expression needs parenthesis when suggesting an `.into()` cast is incorrect. Two broken examples from nightly are:

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(foo as i8);
  |          ^^^^^^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(foo as i8.into());
  |
```

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(*foo);
  |          ^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(*foo.into());
  |
```

As suggested by @petrochenkov switch the precedence check to `PREC_POSTFIX`. This catches both `as` and unary operators. Fixes #47699.

r? @petrochenkov
2018-01-25 15:52:15 +01:00
Guillaume Gomez
3a863a3f45 Rollup merge of #47700 - EdSchouten:cc104, r=kennytm
Remove workarounds for cc 1.0.3.

Now that the Rust codebase depends on cc 1.0.4, there is no longer any
need to specify a compiler for CloudABI manually. Cargo will
automatically call into the right compiler executable.
2018-01-25 15:52:15 +01:00
Guillaume Gomez
df55cee0e5 Rollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe
Point at unknown lang item attribute
2018-01-25 15:52:14 +01:00
Guillaume Gomez
bbdc5b9637 Rollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=estebank
Remove broken redundant backtrace hint

When the compiler driver panics it attempts to show a hint about using `RUST_BACKTRACE`. However, the logic is currently reversed to the hint is only shown if `RUST_BACKTRACE` is **already**   set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just remove the broken duplicate hint entirely.
2018-01-25 15:52:13 +01:00
Guillaume Gomez
83603b8294 Rollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis
NLL test for mutating &mut references

As mentioned in #46361.

cc @nikomatsakis?
2018-01-25 15:52:12 +01:00
Guillaume Gomez
e26aac5a9f Rollup merge of #47534 - estebank:suggest-public-traits, r=petrochenkov
On missing method do not suggest private traits

When encountering a method call for an ADT that doesn't have any
implementation of it, we search for traits that could be implemented
that do have that method. Filter out private non-local traits that would
not be able to be implemented.

This doesn't account for public traits that are in a private scope, but
works as a first approximation and is a more correct behavior than the
current one.

Fix #45781.
2018-01-25 15:52:11 +01:00
bors
4cf26f8a13 Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus
Few fixes for multiple themes support feature

r? @QuietMisdreavus

Fixes #47695.
2018-01-25 06:12:06 +00:00
bors
247835aacb Auto merge of #47374 - topecongiro:issue-47096, r=nikomatsakis
Simplify irrefutable slice patterns

Closes #47096.
2018-01-25 03:20:54 +00:00
bors
a0a9007f8d Auto merge of #47006 - bitshifter:stabilize-repr-align, r=eddyb
Stabilized `#[repr(align(x))]` attribute (RFC 1358)

Stabilzed `#[repr(align(x))]` with attr_literal syntax as proposed by @eddyb https://github.com/rust-lang/rust/issues/33626#issuecomment-348467804
2018-01-25 00:26:17 +00:00
Guillaume Gomez
e78f1392b7 Few fixes for multiple themes support feature 2018-01-24 12:13:52 +01:00
bors
a0dcecff90 Auto merge of #47300 - remexre:duration-constructors-as-const-fns, r=alexcrichton
Makes the constructors of Duration const fns.

This affects `Duration::new`, `Duration::from_secs`, `Duration::from_millis`, `Duration::from_micros`, and `Duration::from_nanos`.
2018-01-24 10:39:25 +00:00
Ryan Cumming
65b1e86aed Fix into() cast paren check precedence
As discussed in #47699 the logic for determining if an expression needs
parenthesis when suggesting an `.into()` cast is incorrect. Two broken
examples from nightly are:

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(foo as i8);
  |          ^^^^^^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(foo as i8.into());
  |
```

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(*foo);
  |          ^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(*foo.into());
  |
```

As suggested by @petrochenkov switch the precedence check to
PREC_POSTFIX. This catches both `as` and unary operators. Fixes #47699.
2018-01-24 20:31:36 +11:00
Ed Schouten
583b382deb Remove workarounds for cc 1.0.3.
Now that the Rust codebase depends on cc 1.0.4, there is no longer any
need to specify a compiler for CloudABI manually. Cargo will
automatically call into the right compiler executable.
2018-01-24 08:30:17 +01:00
bors
9758ff9c0b Auto merge of #47299 - cramertj:unsafe-placer, r=alexcrichton
Make core::ops::Place an unsafe trait

Consumers of `Place` would reasonably expect that the `pointer` function returns a valid pointer to memory that can actually be written to.
2018-01-24 07:22:22 +00:00
Esteban Küber
e6af9ebea2 Point at unknown lang item attribute 2018-01-23 21:36:40 -08:00
bors
a538fe7ce7 Auto merge of #46931 - clarcharr:float_bits_core, r=alexcrichton
Expose float from_bits and to_bits in libcore.

These methods have no dependencies on libm and thus should be offered in libcore.
2018-01-24 03:02:15 +00:00
bors
fdecb0564b Auto merge of #45337 - Zoxc:gen-static, r=nikomatsakis
Immovable generators

This adds support for immovable generators which allow you to borrow local values inside generator across suspension points. These are declared using a `static` keyword:
```rust
let mut generator = static || {
    let local = &Vec::new();
    yield;
    local.push(0i8);
};
generator.resume();

// ERROR moving the generator after it has resumed would invalidate the interior reference
// drop(generator);
```

Region inference is no longer affected by the types stored in generators so the regions inside should be similar to other code (and unaffected by the presence of `yield` expressions). The borrow checker is extended to pick up the slack so interior references still result in errors for movable generators. This fixes #44197, #45259 and #45093.

This PR depends on [PR #44917 (immovable types)](https://github.com/rust-lang/rust/pull/44917), I suggest potential reviewers ignore the first commit as it adds immovable types.
2018-01-23 22:50:03 +00:00
ritiek
06d123d4be Remove similar test that does not run the result 2018-01-23 22:45:10 +05:30
bors
4e3901d35f Auto merge of #47678 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #47423, #47425, #47440, #47541, #47549, #47554, #47558, #47610, #47635, #47655, #47661, #47662, #47667, #47672
- Failed merges:
2018-01-23 16:13:18 +00:00
kennytm
9707b31076
Rollup merge of #47672 - ollie27:rustdoc_auto_traits, r=GuillaumeGomez
rustdoc: Show when traits are auto traits
2018-01-23 22:31:02 +08:00
kennytm
97358644a0
Rollup merge of #47667 - GuillaumeGomez:fix-quoted-search, r=QuietMisdreavus
Fix quoted search

r? @QuietMisdreavus
2018-01-23 22:31:01 +08:00
kennytm
4cc2f96837
Rollup merge of #47662 - spastorino:add_test_to_nll, r=nikomatsakis
Add dynamic-drop test to nll tests also

r? @nikomatsakis

Fixes #47585
2018-01-23 22:31:00 +08:00
kennytm
6dcaa0af20
Rollup merge of #47661 - bjorn3:refactor_driver, r=michaelwoerister
Inline some rustc_driver function
2018-01-23 22:30:59 +08:00
kennytm
117eb68122
Rollup merge of #47655 - etaoins:fix-spurious-warning-on-empty-proc-macro-crate, r=alexcrichton
Fix spurious warning on empty proc macro crates

While attempting to reproduce rust-lang/rust#47086 I noticed the following warning:

```shell
> rustc /dev/null --crate-type proc-macro
warning: unused variable: `registrar`
 --> /dev/null:0:1
```

As there are no macros to register the automatically generated registrar function for the crate has no body. As a result its `registrar` argument is unused triggering the above warning.

The warning is confusing and not easily actionable by the developer. It could also be triggered legitimately by e.g. having all of the macros in a crate #[cfg]'ed out.

Fix by naming the generated argument `_registrar` inside `mk_registrar()`. This suppresses the unused variable warning.
2018-01-23 22:30:58 +08:00
kennytm
9d26a25bb6
Rollup merge of #47635 - Zoxc:remove-attr, r=michaelwoerister
Remove the IGNORED_ATTR_NAMES thread local
2018-01-23 22:30:57 +08:00
bors
3a39b2aa5a Auto merge of #47620 - GuillaumeGomez:multiple-themes, r=QuietMisdreavus
Multiple themes for rustdoc

r? @QuietMisdreavus
2018-01-23 13:23:58 +00:00
Ryan Cumming
5de8e040d2 Remove broken redundant backtrace hint
When the compiler driver panics it attempts to show a hint about using
`RUST_BACKTRACE`. However, the logic is currently reversed to the hint
is only shown if `RUST_BACKTRACE` is *already* set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just
remove the broken duplicate hint entirely.
2018-01-23 20:25:48 +11:00
kennytm
cb0a8bf7d1 Rollup merge of #47610 - cuviper:captured-dwarf, r=eddyb
LLVM5: Update DW_OP_plus to DW_OP_plus_uconst

LLVM <= 4.0 used a non-standard interpretation of `DW_OP_plus`.  In the
DWARF standard, this adds two items on the expressions stack.  LLVM's
behavior was more like DWARF's `DW_OP_plus_uconst` -- adding a constant
that follows the op.  The patch series starting with [D33892] switched
to the standard DWARF interpretation, so we need to follow.

[D33892]: https://reviews.llvm.org/D33892

Fixes #47464
r? @eddyb
2018-01-23 17:03:40 +08:00
kennytm
52f8d2dc35 Rollup merge of #47558 - spastorino:rustc_args, r=nikomatsakis
Add rustc-args option to test runner

r? @nikomatsakis
2018-01-23 17:03:39 +08:00
kennytm
60b987d0a9 Rollup merge of #47554 - EdSchouten:cloudabi-jemalloc, r=nikomatsakis
Make liballoc_jemalloc work on CloudABI.

The automated builds for CloudABI in dist-various-2 don't use
--disable-jemalloc, even though my original container image did. Instead
of setting that flag, let's go the extra mile of making jemalloc work.
CloudABI's C library already uses jemalloc and now exposes the API
extensions used by us.

This makes the CloudABI dist work out of the box.
2018-01-23 17:03:38 +08:00
kennytm
658ccae684 Rollup merge of #47549 - Manishearth:29723-regression, r=nikomatsakis
Add regression test for #29723

cc #29723

r? @nikomatsakis
2018-01-23 17:03:37 +08:00
kennytm
82981a77c4 Rollup merge of #47541 - psumbera:master, r=eddyb
Fixes sparc64 cabi fixes.

Argument up to 16 bytes size is provided in registers.
Return value up to 32 bytes size is stored in registers.

Fixes: #46679

---

Firefox now (almost) build on sparc. Original rust issue seems to be gone. Note that I'm not rust expert and the fix was suggested in bug.
2018-01-23 17:03:36 +08:00
kennytm
150f2baca8 Rollup merge of #47440 - mark-i-m:zunpretty, r=nikomatsakis
Change the --unpretty flag to -Z unpretty

First PR 😄 !

-Z unpretty no longer requires -Z unstable-options.

Also, I mildly changed the syntax of the flag to match the other -Z flags. All uses of the flag take the form `unpretty=something` where something can either `string` or `string=string` (see the help messages of the CLI).

Fix #47395

r? @nikomatsakis EDIT: apparently rust-highfive doesn't see edits...
2018-01-23 17:03:35 +08:00
kennytm
0c9b3ec5b0 Rollup merge of #47425 - EdSchouten:immutable-tls, r=nikomatsakis
Properly pass down immutability info for thread-locals.

For thread-locals we call into cat_rvalue_node() to create a CMT
(Category, Mutability, Type) that always has McDeclared. This is
incorrect for thread-locals that don't have the 'mut' keyword; we should
use McImmutable there.

Extend cat_rvalue_node() to have an additional mutability parameter. Fix
up all the callers to make use of that function. Also extend one of the
existing unit tests to cover this.

Fixes: #47053
2018-01-23 17:03:34 +08:00
kennytm
116fb72d3d Rollup merge of #47423 - est31:rustbook_checking, r=alexcrichton
Check for deadlinks from the summary during book generation

Previously, any deadlinks from a book's SUMMARY.md wouldn't
cause any errors or warnings or similar but mdbook would simply
create a page with blank content.

This has kept bug #47394 hidden. It should have been detected
back in the PR when those wrongly named files got added to the
book.

PR #47414 was one component of the solution. This change
is a second line of defense for the unstable book and a first
line of defense for any other book.

We also update mdbook to the most recent version.
2018-01-23 17:03:32 +08:00
bors
48a7ea9c40 Auto merge of #47046 - Manishearth:intra-doc-links, r=eddyb,GuillaumeGomez,QuietMisdreavus,Manishearth
Implement RFC 1946 - intra-rustdoc links

https://github.com/rust-lang/rfcs/pull/1946 https://github.com/rust-lang/rust/issues/43466

Note for reviewers: The plain line counts are a little inflated because of how the markdown link parsing was done. [Read the file diff with "whitespace only" changes removed](https://github.com/rust-lang/rust/pull/47046/files?w=1) to get a better view of what actually changed there.

This pulls the name/path resolution mechanisms out of the compiler and runs it on the markdown in a crate's docs, so that links can be made to `SomeStruct` directly rather than finding the folder path to `struct.SomeStruct.html`. Check the `src/test/rustdoc/intra-paths.rs` test in this PR for a demo. The change was... a little invasive, but unlocks a really powerful mechanism for writing documentation that doesn't care about where an item was written to on the hard disk.

Items included:

 - [x] Make work with the hoedown renderer
 - [x] Handle relative paths
 - [x] Parse out the "path ambiguities" qualifiers (`[crate foo]`, `[struct Foo]`, `[foo()]`, `[static FOO]`, `[foo!]`, etc)
 - [x] Resolve foreign macros
 - [x] Resolve local macros
 - [x] Handle the use of inner/outer attributes giving different resolution scopes (handling for non-modules pushed to different PR)

Items not included:

 - [ ] Make sure cross-crate inlining works (blocked on refactor described in https://github.com/rust-lang/rust/pull/47046#issuecomment-354824520)
 - [ ] Implied Shortcut Reference Links (where just doing `[::std::iter::Iterator][]` without a reference anchor will resolve using the reference name rather than the link target) (requires modifying the markdown parser - blocked on Hoedown/Pulldown switch and https://github.com/google/pulldown-cmark/issues/121)
 - [ ] Handle enum variants and UFCS methods (Enum variants link to the enum page, associated methods don't link at all)
 - [ ] Emit more warnings/errors when things fail to resolve (linking to a value-namespaced item without a qualifier will emit an error, otherwise the link is just treated as a url, not a rust path)
 - [ ] Give better spans for resolution errors (currently the span for the first doc comment is used)
 - [ ] Check for inner doc comments on things that aren't modules

I'm making the PR, but it should be noted that most of the work was done by Misdreavus 😄

(Editor's note: This has become a lie, check that commit log, Manish did a ton of work after this PR was opened `>_>`)
2018-01-23 07:38:53 +00:00
John Kåre Alsaker
55c6c88782 Port borrows across yield check to MIR borrowck 2018-01-23 05:10:39 +01:00
John Kåre Alsaker
410d27bb97 Add dropck test 2018-01-23 05:10:39 +01:00
John Kåre Alsaker
bae2988e6f Fix yield-while-local-borrowed.rs test 2018-01-23 05:10:39 +01:00
John Kåre Alsaker
9b57e60f03 Use delay_span_bug for things that should be errors 2018-01-23 05:10:38 +01:00
John Kåre Alsaker
c166ef9d1b Make immovable generators unsafe 2018-01-23 05:10:38 +01:00
John Kåre Alsaker
ccf0d8399e Adds support for immovable generators. Move checking of invalid borrows across suspension points to borrowck. Fixes #44197, #45259 and #45093. 2018-01-23 05:10:38 +01:00
Oliver Middleton
04a884726a rustdoc: Show when traits are auto traits 2018-01-23 01:04:24 +00:00
Guillaume Gomez
5b8504401c Fasten even more theme switch 2018-01-23 00:45:34 +01:00
bors
47a8eb7c4e Auto merge of #47373 - wesleywiser:incr_cache_hashing, r=michaelwoerister
[Incremental] Cache hashes for AdDef and ty::Slice<T>

r? @michaelwoerister
2018-01-22 23:32:16 +00:00
QuietMisdreavus
63811b66f6 don't process code blocks when scanning for links 2018-01-22 17:04:55 -06:00
Guillaume Gomez
5f93159e9d Fasten up theme loading 2018-01-22 23:44:08 +01:00
Guillaume Gomez
7cc3cb29bd Fix quoted search 2018-01-22 22:49:44 +01:00
Cameron Hart
651ea8ea44 Stabilized #[repr(align(x))] attribute (RFC 1358) 2018-01-23 08:36:13 +11:00
Guillaume Gomez
3c52acd9ca Change theme icon 2018-01-22 21:47:39 +01:00