Commit Graph

100862 Commits

Author SHA1 Message Date
bors
53aca553ec Auto merge of #65172 - tanriol:explain_borrow-use-context-dominators, r=nagisa
use precalculated dominators in explain_borrow

This looks like the only place calculating dominators from the MIR body every time instead of using the ones stored on the `MirBorrowckCtxt`. For example, in rust-lang/rust#65131 a big generated function with a number of borrowck errors takes a few hours(!) recalculating the dominators while explaining the errors.

I don't know enough about this part of rustc codebase to know for sure that this change is correct, but no tests seem to fail as a result of this change in local testing.
2019-10-16 12:49:49 +00:00
Guillaume Gomez
7d357fbffd update ui tests 2019-10-16 13:56:14 +02:00
Guillaume Gomez
e5d566c080 Add long error explanation for E0573 2019-10-16 13:56:14 +02:00
Mazdak Farrokhzad
be40bbd2fb make tidy happy 2019-10-16 11:19:39 +02:00
Mazdak Farrokhzad
904168fe14 mbe: leave a FIXME 2019-10-16 10:59:54 +02:00
Mazdak Farrokhzad
9dc07b05d5 parser: leave a FIXME for later 2019-10-16 10:59:54 +02:00
Mazdak Farrokhzad
bf02d49e84 move SeqSep to parser.rs 2019-10-16 10:59:54 +02:00
Mazdak Farrokhzad
d420d719c4 move syntax::ext to new crate syntax_expand 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
d160a4e422 syntax::parse: don't depend on syntax::ext 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
7ec38a9ae3 attr: remove dep on ExtCtxt 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
55f3c2d59a ast: use more direct imports 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
c189565edc syntax: reduce visibilities 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
98017ca53a move diagnostics.rs into parser/ 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
41bfe94d40 syntax: extract parse_cfg_attr 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
7d7969d065 syntax: extract parse_derive_paths 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad
9dba03f6cd move parse::attr -> parse::parser::attr 2019-10-16 10:59:53 +02:00
boyned//Kampfkarren
247df6e134
Don't recommend ONCE_INIT in std::sync::Once
ONCE_INIT is deprecated, and so suggesting it as not only being on par with, but before `Once::new` is a bad idea.
2019-10-16 00:06:01 -07:00
bors
bfc58789a4 Auto merge of #65450 - Manishearth:clippyup, r=Manishearth
Update clippy

Fixes #65446.
r? @ghost
2019-10-16 05:08:00 +00:00
bors
f54911c6f2 Auto merge of #65454 - tmandry:rollup-0k6jiik, r=tmandry
Rollup of 14 pull requests

Successful merges:

 - #64603 (Reducing spurious unused lifetime warnings.)
 - #64623 (Remove last uses of gensyms)
 - #65235 (don't assume we can *always* find a return type hint in async fn)
 - #65242 (Fix suggestion to constrain trait for method to be found)
 - #65265 (Cleanup librustc mir err codes)
 - #65293 (Optimize `try_expand_impl_trait_type`)
 - #65307 (Try fix incorrect "explicit lifetime name needed")
 - #65308 (Add long error explanation for E0574)
 - #65353 (save-analysis: Don't ICE when resolving qualified type paths in struct members)
 - #65389 (Return `false` from `needs_drop` for all zero-sized arrays.)
 - #65402 (Add troubleshooting section to PGO chapter in rustc book.)
 - #65425 (Optimize `BitIter`)
 - #65438 (Organize `never_type`  tests)
 - #65444 (Implement AsRef<[T]> for List<T>)

Failed merges:

 - #65390 (Add long error explanation for E0576)

r? @ghost
2019-10-15 23:09:33 +00:00
Tyler Mandry
3182f73e8d
Rollup merge of #65444 - spastorino:as-ref-for-list, r=Mark-Simulacrum
Implement AsRef<[T]> for List<T>

r? @Mark-Simulacrum
2019-10-15 16:08:00 -07:00
Tyler Mandry
ef5420301d
Rollup merge of #65438 - Centril:almost, r=varkor
Organize `never_type`  tests

Extracted from https://github.com/rust-lang/rust/pull/65355.
This just moves some tests around to make things better categorized.

r? @varkor
2019-10-15 16:07:58 -07:00
Tyler Mandry
641607902e
Rollup merge of #65425 - nnethercote:optimize-BitIter, r=zackmdavis
Optimize `BitIter`

A minor speed improvement.
2019-10-15 16:07:57 -07:00
Tyler Mandry
2dac8b9176
Rollup merge of #65402 - michaelwoerister:pgo-troubleshooting-docs, r=alexcrichton
Add troubleshooting section to PGO chapter in rustc book.

- Adds a note about using `-pgo-warn-missing-function` in order to spot mistakes in PGO setup.
- Mentions cargo symbol name issue fixed in 1.39.

Nominating for backport.

r? @alexcrichton
2019-10-15 16:07:55 -07:00
Tyler Mandry
bbcf66a4a1
Rollup merge of #65389 - ecstatic-morse:zero-sized-array-no-drop, r=eddyb
Return `false` from `needs_drop` for all zero-sized arrays.

Resolves #65348.

This changes the result of the `needs_drop` query from `true` to `false` for types such as `[Box<i32>; 0]`. I believe this change to be sound because a zero-sized array can never actually hold a value. This is an elegant way of resolving #65348 and #64945, but obviously it has much broader implications.
2019-10-15 16:07:53 -07:00
Tyler Mandry
820fb7ccbf
Rollup merge of #65353 - Xanewok:sa-empty-tables, r=nikomatsakis
save-analysis: Don't ICE when resolving qualified type paths in struct members

Previously, we failed since we use `qpath_res` via typeck tables - when using those we need to pass in a HirId that's local to the definition path the tables are rooted at (otherwise we risk frame of reference mismatch and an assertion against invalid lookup).

In this case we can't get typeck tables for struct definition because it has no body, however the struct member type node is rooted under the struct definition and so we can't really do anything about it in terms of traversal.

Instead, we try to "nest" the tables as always but change the default behaviour to use empty typeck tables rather than silently trying to use the current ones. This does work as we expect and for prior art, we use the same approach in the [privacy](7bc94cc3c2/src/librustc_privacy/lib.rs (L332-L341)) [pass](7bc94cc3c2/src/librustc_privacy/lib.rs (L1007-L1028)).

Fixes #64659.
Fixes #64821.

r? @nikomatsakis (since this changes the default behaviour introduced in d7d3f197f6)
2019-10-15 16:07:52 -07:00
Tyler Mandry
42b35968fb
Rollup merge of #65308 - GuillaumeGomez:long-err-explanation-E0574, r=matthewjasper
Add long error explanation for E0574

Part of #61137.
2019-10-15 16:07:50 -07:00
Tyler Mandry
ff9b99dcd6
Rollup merge of #65307 - Phosphorus15:master, r=varkor
Try fix incorrect "explicit lifetime name needed"

This pr is trying to fixes #65285 .
2019-10-15 16:07:49 -07:00
Tyler Mandry
a6ae7ae63f
Rollup merge of #65293 - tmandry:turbo-expander, r=matthewjasper
Optimize `try_expand_impl_trait_type`

A lot of time was being spent expanding some large `impl Future` types in fuchsia. This PR takes the number of types being visited in one expansion from >3 billion to about a thousand, and eliminates the compile time regression in https://github.com/rust-lang/rust/issues/65147 (in fact, compile times are better than they were before).

Thanks to @Mark-Simulacrum for helping identify the issue and to @matthewjasper for suggesting this change.

Fixes #65147.
r? @matthewjasper,@nikomatsakis
2019-10-15 16:07:47 -07:00
Tyler Mandry
8f09085bb0
Rollup merge of #65265 - GuillaumeGomez:cleanup-librustc_mir-err-codes, r=Mark-Simulacrum
Cleanup librustc mir err codes

Three things are done in this PR:

 * Sort error codes
 * Uncomment an error code long error explanation (they should **never** be commented)
 * Unify explanations
2019-10-15 16:07:46 -07:00
Tyler Mandry
ef9d6ee8ad
Rollup merge of #65242 - estebank:contrain-trait-sugg, r=varkor
Fix suggestion to constrain trait for method to be found

Fix #65044.
2019-10-15 16:07:44 -07:00
Tyler Mandry
bbf4eb3fc2
Rollup merge of #65235 - nikomatsakis:issue-65159-async-fn-return-ice, r=cramertj
don't assume we can *always* find a return type hint in async fn

In particular, we sometimes cannot if there is an earlier error.

Fixes #65159

r? @cramertj, who reviewed the original PR
2019-10-15 16:07:43 -07:00
Tyler Mandry
af3d9e57e7
Rollup merge of #64623 - matthewjasper:underscore-imports, r=petrochenkov
Remove last uses of gensyms

Underscore bindings now use unique `SyntaxContext`s to avoid collisions. This was the last use of gensyms in the compiler, so this PR also removes them.

closes #49300
cc #60869

r? @petrochenkov
2019-10-15 16:07:41 -07:00
Tyler Mandry
fcef4b1aef
Rollup merge of #64603 - gilescope:unused-lifetime-warning, r=matthewjasper
Reducing spurious unused lifetime warnings.

Fixes #61115, fixes #64493.
2019-10-15 16:07:39 -07:00
Esteban Küber
c6dce7802d Fix comparison after rebase 2019-10-15 14:07:32 -07:00
Esteban Küber
9ecd1d2767 Simplify code 2019-10-15 13:55:44 -07:00
Esteban Küber
9ed463a740 Do not suggest restriction on spans originating in macros 2019-10-15 13:55:44 -07:00
Esteban Küber
9c525ee95b review comments 2019-10-15 13:55:44 -07:00
Esteban Küber
8cabb42541 Remove trailing whitespace 2019-10-15 13:55:44 -07:00
Esteban Küber
39a9e2ecba Remove useless help 2019-10-15 13:55:44 -07:00
Esteban Küber
ab7d8f0f5a Deduplicate some code and apply review comments 2019-10-15 13:55:44 -07:00
Esteban Küber
bc744bca90 Suggest associated bound restrictions in impls 2019-10-15 13:55:44 -07:00
Esteban Küber
5cc99eed04 Handle missing projection restriction 2019-10-15 13:55:44 -07:00
Esteban Küber
daa8491648 Update NLL tests 2019-10-15 13:55:44 -07:00
Esteban Küber
b81df6b739 Consider trait aliases 2019-10-15 13:55:44 -07:00
Esteban Küber
ca1885de41 Update some tests involving Self 2019-10-15 13:55:43 -07:00
Esteban Küber
99ab45b91d Handle Self restriction needed 2019-10-15 13:55:43 -07:00
Esteban Küber
dbd75c8c40 Handle more cases involving impl and trait 2019-10-15 13:55:43 -07:00
Esteban Küber
5b7ffd9333 Handle more cases 2019-10-15 13:55:43 -07:00
Esteban Küber
190589f8a7 Use structured suggestion for restricting bounds
When a trait bound is not met and restricting a type parameter would
make the restriction hold, use a structured suggestion pointing at an
appropriate place (type param in param list or `where` clause).

Account for opaque parameters where instead of suggesting extending
the `where` clause, we suggest appending the new restriction:
`fn foo(impl Trait + UnmetTrait)`.
2019-10-15 13:55:43 -07:00
Manish Goregaokar
33543ed122 Update clippy 2019-10-15 13:52:34 -07:00