Commit Graph

81699 Commits

Author SHA1 Message Date
John Kåre Alsaker
401af7994d Record adjustments and original type for expressions in the generator interior 2018-08-07 04:44:35 +02: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
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
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
varkor
8d7638fa69 Fix failure on msvc 2018-08-05 17:42:58 +01:00
varkor
d027cc8ee1 Change feature edition error into a warning 2018-08-05 15:54:49 +01:00
varkor
c157ec87ed Fix 2018 edition tests 2018-08-05 15:54:49 +01:00
varkor
5815a84280 Remove references to unknown feature io 2018-08-05 15:54:49 +01:00
varkor
60ad63640f Add an error when declaring features that are stable in the current Rust edition 2018-08-05 15:54:49 +01:00
varkor
d19832105e Remove bad features after rebase 2018-08-05 15:54:49 +01:00
varkor
bd90137b94 Improve query efficiency 2018-08-05 15:54:49 +01:00
varkor
e5d5e6a560 Fix outdated handling of GetLangItems 2018-08-05 15:54:49 +01:00
varkor
319b052357 Fix stage 2 tests 2018-08-05 15:54:49 +01:00
varkor
8cee487eb3 Fix rustdoc test 2018-08-05 15:54:49 +01:00
varkor
f22ccbe315 Fix run-pass-fulldeps tests 2018-08-05 15:54:49 +01:00
varkor
f2fd00005e Fix incremental tests 2018-08-05 15:54:49 +01:00
varkor
f91d7baaa4 Add special support for libc 2018-08-05 15:54:49 +01:00
varkor
53add5d7d3 Add support for feature attributes on macros 2018-08-05 15:54:49 +01:00
varkor
120989195f Convert unknown_features lint into an error 2018-08-05 15:54:49 +01:00
varkor
47619c0dc7 Turn the duplicate feature lint into an error 2018-08-05 15:54:49 +01:00
varkor
c81b95f305 Remove unnecessary feature attributes that sneaked in 2018-08-05 15:54:49 +01:00
varkor
bd66cbb806 Remove obsolete tests in tidy
These have been replaced by more reliable checks in the compiler itself.
2018-08-05 15:54:49 +01:00
varkor
af77c42e38 Remove panic-runtime opt-out 2018-08-05 15:54:49 +01:00
varkor
1511df2521 Add a test for feature attribute consistency
Note that this doesn't test consistency of some properties, like `reason`.
2018-08-05 15:54:49 +01:00
varkor
372e128476 Add test for duplicate features 2018-08-05 15:54:49 +01:00
varkor
c717ccba17 Add a test for unknown features 2018-08-05 15:54:49 +01:00
varkor
671a81738d Fix test/ui 2018-08-05 15:54:49 +01:00
varkor
895fcec3b4 Fix test/compile-fail 2018-08-05 15:54:49 +01:00
varkor
279fbaa29c Fix test/run-pass 2018-08-05 15:54:49 +01:00
varkor
61b9d87c28 Fix test/run-fail 2018-08-05 15:54:49 +01:00
varkor
99db9d63eb Fix test/debuginfo 2018-08-05 15:54:49 +01:00
varkor
82a98ac03d Get around tidy bug 2018-08-05 15:54:49 +01:00
varkor
a92d3a3606 Add duplicity lint for lang features 2018-08-05 15:54:49 +01:00
varkor
fc99ea7ffa Add a lint for duplicate feature attributes 2018-08-05 15:54:49 +01:00
varkor
3584601715 Trigger stable feature lint for lib features 2018-08-05 15:54:49 +01:00
varkor
70ff6fd46f Add error for inconsistent stability since value 2018-08-05 15:54:49 +01:00
varkor
5242dce01d Add lint for unknown feature attributes 2018-08-05 15:54:49 +01:00
varkor
a00ba4d71e Correct invalid feature attributes 2018-08-05 15:54:49 +01:00
varkor
64185f205d Remove unnecessary or invalid feature attributes 2018-08-05 15:54:48 +01:00
bors
93a4cab45a Auto merge of #52983 - alexcrichton:update-llvm, r=kennytm
Update LLVM submodule to 7.0

This commit updates the following submodules to LLVM's [recently branched][1]
7.0 release branch:

* src/llvm
* src/tools/lld
* src/libcompiler_builtins/compiler-rt

[1]: https://lists.llvm.org/pipermail/llvm-dev/2018-August/125004.html

Closes #52970
2018-08-05 14:51:16 +00:00
bors
9f9ac89d11 Auto merge of #52959 - matthewjasper:closure-spans, r=pnkfelix
[NLL] Use smaller spans for errors involving closure captures

Closes #51170
Closes #46599

Error messages involving closures now point to the captured variable/closure args.

r? @pnkfelix
2018-08-05 09:17:24 +00:00
bors
b47c314c56 Auto merge of #52991 - nikomatsakis:nll-escaping-into-return, r=pnkfelix
avoid computing liveness for locals that escape into statics

Fixes #52713

I poked at this on the plane and I think it's working -- but I want to do a bit more investigation and double check. The idea is to identify those local variables where the entire value will "escape" into the return -- for them, we don't need to compute liveness, since we know that the outlives relations from the return type will force those regions to be equal to free regions. This should help with html5ever in particular.

- [x] test performance
- [x] verify correctness
- [x] add comments

r? @pnkfelix
cc @lqd
2018-08-05 07:06:11 +00:00
Niko Matsakis
2e2ea26a83 remove unused tcx argument 2018-08-05 07:42:18 +02:00