Commit Graph

81748 Commits

Author SHA1 Message Date
Niko Matsakis
fb1702f301 compute liveness later 2018-08-07 14:52:59 -04:00
bors
ccb550fb45 Auto merge of #53109 - nikomatsakis:nll-escaping-into-return-revert, r=nikomatsakis
revert #52991

Reverts https://github.com/rust-lang/rust/pull/52991 which is flawed. I have an idea how to fix it but might as well revert first since it is so wildly flawed. That's what I get for opening PRs while on PTO =)

r? @pnkfelix
2018-08-07 16:01:27 +00:00
bors
39e9516532 Auto merge of #51990 - oli-obk:unstable_union, r=nikomatsakis
Place unions, pointer casts and pointer derefs behind extra feature gates

To ensure we don't stabilize these things together with const fn stabilization (or any other stabilization)

This PR moves union field accesses inside `const fn` behind a feature gate. It was possible without a feature gate before, but since `const fn` was behind a feature gate we can do this change.

While "dereferencing raw pointers" and "casting raw pointers to usize" were hard errors before this PR, one could work around them by abusing unions:

```rust
// deref
union Foo<T> {
    x: &'static T,
    y: *const T,
}
const FOO: u32 = unsafe { *Foo { y: 42 as *const T }.x };

// as usize cast
union Bar<T> {
    x: usize,
    y: *const T,
}
const BAR: usize = unsafe { Bar { y: &1u8 }.x };
```

r? @eddyb

cc @nikomatsakis
2018-08-07 13:14:37 +00:00
Oliver Schneider
4b731a908b Fix tidy 2018-08-07 14:41:33 +02:00
Oliver Schneider
a091a6567c Make sure the feature gate actually works and never allows promoting these operations 2018-08-07 14:41:33 +02:00
Oliver Schneider
aa0884ecc1 Add feature gate test 2018-08-07 14:41:33 +02:00
Oliver Schneider
36907fc18d Also put comparing raw pointers behind a feature gate 2018-08-07 14:41:33 +02:00
Oliver Schneider
1fc7580a8e Rebase fallout: new tests need updated ui output 2018-08-07 14:41:33 +02:00
Oliver Schneider
07e2dd7d96 Don't accidentally promote union access in MIR 2018-08-07 14:41:33 +02:00
Oliver Schneider
c0aedc0b6a Use the correct feature gate name 2018-08-07 14:41:33 +02:00
Oliver Schneider
fee07534bb Add feature gate checks 2018-08-07 14:41:33 +02:00
Oliver Schneider
3ef863bfdf Place unions, pointer casts and pointer derefs behind extra feature gates 2018-08-07 14:41:33 +02:00
bors
18925dee25 Auto merge of #53150 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

Successful merges:

 - #52885 (Remove some unused method arguments from typeck)
 - #52886 (cleanup: Remove `Def::GlobalAsm`)
 - #53028 (Building librustc_codegen_llvm in a separate directory)
 - #53052 (fixed broken links to char)
 - #53060 (Change rustdoc style so fully qualified name does not overlap src link)
 - #53068 (Rename Executor trait to Spawn)
 - #53093 (Enable macros to pass $:literal to another macro)
 - #53107 (Remove references to `StaticMutex` which got removed a while ago)
 - #53135 (Rust 2018: Disable catch_expr, not targeted for 2018 edition)
 - #53139 (set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target)
2018-08-07 11:00:07 +00:00
kennytm
d9e9230b1d
Rollup merge of #53139 - danc86:riscv-no-gdb-scripts, r=petrochenkov
set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target

Same as the other embedded targets, see:
https://github.com/rust-lang/rust/pull/49728

This is a temporary workaround for #44993.
2018-08-07 18:52:20 +08:00
kennytm
9da780dcc7
Rollup merge of #53135 - joshtriplett:remove-catch-from-2018-preview, r=Mark-Simulacrum
Rust 2018: Disable catch_expr, not targeted for 2018 edition

Fixes #52604
2018-08-07 18:51:51 +08:00
kennytm
a5cd4b5607
Rollup merge of #53107 - RalfJung:static-mutex, r=alexcrichton
Remove references to `StaticMutex` which got removed a while ago

`StaticMutex` got removed two years ago with https://github.com/rust-lang/rust/pull/34705, but still got referenced in some comments and even an error explanation.
2018-08-07 16:55:44 +08:00
kennytm
c1220610ef
Rollup merge of #53093 - 0e4ef622:issue-52169-fix, r=petrochenkov
Enable macros to pass $:literal to another macro

Fixes #52169.
2018-08-07 16:55:43 +08:00
kennytm
3385cae74a
Rollup merge of #53068 - MajorBreakfast:spawn, r=cramertj
Rename Executor trait to Spawn

Renames the `Executor` trait to `Spawn` and the method on `Context` to `spawner`.

Note: Best only merge this after we've the alpha 3 announcement post ready.

r? @cramertj
2018-08-07 16:55:42 +08:00
kennytm
25e32903ef
Rollup merge of #53060 - iliekturtles:rustdoc-style, r=GuillaumeGomez
Change rustdoc style so fully qualified name does not overlap src link

A type's fully qualified name will now wrap once it gets to the
`[-][src]` link aligned against the right edge of the content area.
Previously the two would overlap and the name would only wrap when
hitting the edge of the content area.

Before:
![image](https://user-images.githubusercontent.com/5081378/43676506-cf548758-97c0-11e8-80a0-a812d8ea0eef.png)

After:
![image](https://user-images.githubusercontent.com/5081378/43676509-e78810a6-97c0-11e8-8cd4-b90bd5858a5f.png)
2018-08-07 16:55:41 +08:00
kennytm
b1ca710c5d
Rollup merge of #53052 - redroc:master, r=QuietMisdreavus
fixed broken links to char

fixes https://github.com/rust-lang/rust/issues/32129
2018-08-07 16:55:40 +08:00
kennytm
35d752f130
Rollup merge of #53028 - Mark-Simulacrum:split-out-codegen, r=alexcrichton
Building librustc_codegen_llvm in a separate directory

This allows clearing it out and building it separately from the
compiler. Since it's essentially a different and separate crate this
makes sense to do, each cargo invocation should generally happen in its
own directory.

r? @alexcrichton
2018-08-07 16:55:38 +08:00
kennytm
2c388e0e9f
Rollup merge of #52886 - petrochenkov:noga, r=alexcrichton
cleanup: Remove `Def::GlobalAsm`

Global asm is not something that needs to have a `Def` or `DefId`.
2018-08-07 16:55:37 +08:00
kennytm
4176888c98
Rollup merge of #52885 - Mark-Simulacrum:cleanup-typeck, r=nikomatsakis
Remove some unused method arguments from typeck

None
2018-08-07 16:55:36 +08:00
bors
9e472c2ace Auto merge of #52450 - PramodBisht:issue/52413, r=estebank
Closes #52413: Provide structured suggestion instead of label

Provide structured suggestion instead of label
r? @estebank
2018-08-07 08:50:12 +00:00
bors
11a902431b Auto merge of #51007 - AstralSorcerer:master, r=nagisa
Make globals with private linkage unnamed. Fixes #50862.

cc @oli-obk @nagisa
2018-08-07 02:12:35 +00:00
Dan Callaghan
ce1def176d
set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target
Same as the other embedded targets, see:
https://github.com/rust-lang/rust/pull/49728

This is a temporary workaround for #44993.
2018-08-07 11:01:22 +10:00
bors
f9b9b6e078 Auto merge of #53134 - alexcrichton:tweak-travis, r=Mark-Simulacrum
More debugging for travis shutting down

Requested by Travis!
2018-08-07 00:07:56 +00:00
bors
45a9d410f9 Auto merge of #53016 - scottmcm:impl-header-lifetime-elision, r=nikomatsakis
Extract impl_header_lifetime_elision out of in_band_lifetimes

This way we can experiment with `impl Debug for &MyType` separately from `impl Debug for &'a MyType`.

I can't say I know what the code in here is doing, so please let me know if there's a better way 🙂

I marked this as enabled in 2018 so that edition code continues to work without another flag.

Actual feature PR https://github.com/rust-lang/rust/pull/49251; Tracking Issue https://github.com/rust-lang/rust/issues/15872; In-band lifetimes tracking issue https://github.com/rust-lang/rust/issues/44524.

cc @aturon, per discussion on discord earlier
cc @cramertj & @nikomatsakis, who actually wrote these features
2018-08-06 21:45:32 +00:00
Josh Triplett
1fd8e57c5b Rust 2018: Disable catch_expr, not targeted for 2018 edition
Fixes #52604
2018-08-06 14:45:19 -07:00
Alex Crichton
43974b2b71 More debugging for travis shutting down
Requested by Travis!
2018-08-06 14:23:13 -07:00
bors
cf84056149 Auto merge of #53115 - davidtwco:issue-52739, r=nikomatsakis
Disable some nice region errors in NLL mode.

Fixes #52739. cc #52742.

r? @nikomatsakis
2018-08-06 19:15:05 +00:00
David Wood
37ba9ca334
Disable some nice region errors in NLL mode. 2018-08-06 20:43:16 +02:00
Pramod Bisht
49b0a1e073 #52413: addressed @estebank's Nit 2018-08-06 17:56:24 +00:00
bors
b239743753 Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboats
Add errors for unknown, stable and duplicate feature attributes

- Adds an error for unknown (lang and lib) features.
- Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features).
- Adds an error for duplicate (lang and lib) features.

```rust
#![feature(fake_feature)] //~ ERROR unknown feature `fake_feature`

#![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0

#![feature(non_exhaustive)]
#![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute
```

Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features).

There are a few outstanding problems, that I haven't narrowed down yet:
- [x] Stability attributes on macros do not seem to be taken into account.
- [x] Stability attributes behind `cfg` attributes are not taken into account.
- [x] There are failing incremental tests.
2018-08-06 16:58:27 +00:00
varkor
4687476470 Special-case "test" feature 2018-08-06 16:46:08 +01:00
bors
4b8089daf8 Auto merge of #52990 - Aaron1011:fix/rustdoc-auto-trait-static, r=eddyb
Fix ICE when rustdoc encounters certain usages of HRTBs

Fixes #51236

Under certain circumstances, `AutoTraitFinder` could end up computing a `ParamEnv` involving two trait predicates that differed only in the region parameters involved. One of these parameters would be a HRTB, while the other would be a normal region parameter.

When this `ParamEnv` was later passed to `SelectionContext`, an `Ambiguity` error would occur, since the erased versions of these predicates would be identical. To solve the issue, we de-duplicate our list of predicates as we build it up. Whenever we encounter two predicates that differ only in their assignment of region parameters (a HRTB vs a normal lifetime parameter), we pick the HRTB. This corresponds to selecting a 'stricter' bound to display in the generated documentation: we're requiring that a particular type works for all possible lifetime parameters if it's going to implement a particular auto trait.
2018-08-06 14:07:22 +00:00
Niko Matsakis
3b4ed18d1c add test case showing how previous attempt was unsound 2018-08-06 09:00:35 -04:00
Mark Rousskov
d8e8a50cf2 Building librustc_codegen_llvm in a separate directory
This allows clearing it out and building it separately from the
compiler. Since it's essentially a different and separate crate this
makes sense to do, each cargo invocation should generally happen in its
own directory.
2018-08-06 07:00:34 -06:00
Niko Matsakis
67c96edce6 revert #52991 2018-08-06 09:00:08 -04:00
bors
78ec12df02 Auto merge of #53045 - pnkfelix:issue-53026-migrate-never-looser-than-ast-borrowck, r=estebank
Fix NLL migration mode so that reports region errors when necessary.

The code here was trying to be clever, and say "lets not report diagnostics when we 'know' NLL will report an error about them in the future."

The problem is that in migration mode, when no error was reported here, the NLL error that we "knew" was coming was downgraded to a warning (!).

Thus causing #53026

(I hope it is the only instance of such a scenario, but we will see.)

Anyway, this PR fixes that by only doing the "clever" skipping of region error reporting when we are not in migration mode. As noted in the FIXME, I'm not really thrilled with this band-aid, but it is small enough to be back-ported easily if that is necessary.

Rather than make a separate test for issue 53026, I just took the test that uncovered this in a first place, and extended it (via our revisions system) to explicitly show all three modes in action: AST-borrowck, NLL, and NLL migration mode.

(To be honest I hope not to have to add such revisions to many tests. Instead I hope to adopt some sort of new `compare-mode` for either borrowck=migrate or for the 2018 edition as a whole.)

Fix #53026
2018-08-06 12:00:12 +00:00
Ralf Jung
a92b5cc916 Remove references to StaticMutex which got removed a while ago 2018-08-06 12:34:00 +02:00
Josef Reinhard Brandl
60aa11df4c Rename Executor trait to Spawn 2018-08-06 12:18:47 +02:00
bors
7c98d2e63f Auto merge of #52332 - zackmdavis:dead_code_lint_should_say_2_electric_boogaloo, r=pnkfelix
dead-code lint: say "constructed" for structs

Respectively.

This is a sequel to November 2017's #46103 / 1a9dc2e9. It had been
reported (more than once—at least #19140, #44083, and #44565) that the
"never used" language was confusing for enum variants that were "used"
as match patterns, so the wording was changed to say never "constructed"
specifically for enum variants. More recently, the same issue was raised
for structs (#52325). It seems consistent to say "constructed" here,
too, for the same reasons.

~~While we're here, we can also use more specific word "called" for unused
functions and methods. (We declined to do this in #46103, but the
rationale given in the commit message doesn't actually make sense.)~~

This resolves #52325.
2018-08-06 07:02:11 +00:00
bors
aa1e6db709 Auto merge of #53002 - QuietMisdreavus:brother-may-i-have-some-loops, r=pnkfelix
make `everybody_loops` preserve item declarations

First half of https://github.com/rust-lang/rust/issues/52545.

`everybody_loops` is used by rustdoc to ensure we don't contain erroneous references to platform APIs if one of its uses is pulled in by `#[doc(cfg)]`. However, you can also implement traits for public types inside of functions. This is used by Diesel (probably others, but they were the example that was reported) to get around a recent macro hygiene fix, which has caused their crate to fail to document. While this won't make the traits show up in documentation (that step comes later), it will at least allow files to be generated.
2018-08-06 01:53:58 +00:00
bors
e9fa9f5a6a Auto merge of #52997 - llogiq:tiny-list-opt, r=varkor
data_structures: make TinyList more readable and optimize remove(_)

also add benchmarks

Before:

```
test tiny_list::test::bench_insert_empty             ... bench:           1 ns/iter (+/- 0)
test tiny_list::test::bench_insert_one               ... bench:          16 ns/iter (+/- 0)
test tiny_list::test::bench_remove_empty             ... bench:           2 ns/iter (+/- 0)
test tiny_list::test::bench_remove_one               ... bench:           6 ns/iter (+/- 0)
test tiny_list::test::bench_remove_unknown           ... bench:           4 ns/iter (+/- 0)
```

After:

```
test tiny_list::test::bench_insert_empty             ... bench:           1 ns/iter (+/- 0)
test tiny_list::test::bench_insert_one               ... bench:          16 ns/iter (+/- 0)
test tiny_list::test::bench_remove_empty             ... bench:           0 ns/iter (+/- 0)
test tiny_list::test::bench_remove_one               ... bench:           3 ns/iter (+/- 0)
test tiny_list::test::bench_remove_unknown           ... bench:           2 ns/iter (+/- 0)
```
2018-08-05 22:41:07 +00:00
varkor
7e7622a714 Fix WASM tests 2018-08-05 22:48:49 +01:00
varkor
a8b5b95d65 Fix diagnostic_list error 2018-08-05 22:26:06 +01:00
bors
73c78734ba Auto merge of #52800 - QuietMisdreavus:do-not-pass-go, r=GuillaumeGomez
rustdoc: refactor how passes are structured, and turn intra-doc-link collection into a pass

This builds on https://github.com/rust-lang/rust/pull/52751 and should not be merged until that finally finishes the bors queue

Part 2 of my passes refactor. This introduces the concept of an "early pass", which is run right before exiting the compiler context. This is important for passes that may want to ask the compiler about things. For example, i took out the intra-doc-link collection and turned it into a early pass. I also made the `strip-hidden`, `strip-private` and `strip-priv-imports` passes occur as early passes, so that intra-doc-link collection wouldn't run on docs that weren't getting printed.

Fixes https://github.com/rust-lang/rust/issues/51684, technically https://github.com/rust-lang/rust/issues/51468 too but that version of `h2` hits a legit intra-link error after that `>_>`

r? @rust-lang/rustdoc
2018-08-05 18:45:01 +00:00
Pramod Bisht
19401086df Closes #52413: Provide structured suggestion instead of label 2018-08-05 18:44:03 +00:00
varkor
8d7638fa69 Fix failure on msvc 2018-08-05 17:42:58 +01:00