-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Lower extra lifetimes before normal generic params. #143430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cjgillot
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
cjgillot:extra-lifetime-swap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+71
−11
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//! Regression test for <https://github.com/rust-lang/rust/issues/143413> | ||
//! The anonymous lifetime in `c(&())` is desugared by the resolver as an extra lifetime parameter | ||
//! at the end of the `for` binder. Verify that lowering creates the definition for that extra | ||
//! lifetime parameter before lowering `c(&())`. | ||
|
||
type A = for<const B: c(&())> D; | ||
//~^ ERROR cannot find type `c` in this scope | ||
//~| ERROR cannot find trait `D` in this scope | ||
//~| ERROR only lifetime parameters can be used in this context | ||
//~| WARN trait objects without an explicit `dyn` are deprecated | ||
//~| WARN this is accepted in the current edition | ||
|
||
fn main() {} |
40 changes: 40 additions & 0 deletions
40
tests/ui/lifetimes/elided-lifetime-in-const-param-type.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
error[E0412]: cannot find type `c` in this scope | ||
--> $DIR/elided-lifetime-in-const-param-type.rs:6:23 | ||
| | ||
LL | type A = for<const B: c(&())> D; | ||
| ^ not found in this scope | ||
|
||
error[E0405]: cannot find trait `D` in this scope | ||
--> $DIR/elided-lifetime-in-const-param-type.rs:6:31 | ||
| | ||
LL | type A = for<const B: c(&())> D; | ||
| ^ not found in this scope | ||
|
||
error[E0658]: only lifetime parameters can be used in this context | ||
--> $DIR/elided-lifetime-in-const-param-type.rs:6:20 | ||
| | ||
LL | type A = for<const B: c(&())> D; | ||
| ^ | ||
| | ||
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information | ||
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
warning: trait objects without an explicit `dyn` are deprecated | ||
--> $DIR/elided-lifetime-in-const-param-type.rs:6:10 | ||
| | ||
LL | type A = for<const B: c(&())> D; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! | ||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> | ||
= note: `#[warn(bare_trait_objects)]` on by default | ||
help: if this is a dyn-compatible trait, use `dyn` | ||
| | ||
LL | type A = dyn for<const B: c(&())> D; | ||
| +++ | ||
|
||
error: aborting due to 3 previous errors; 1 warning emitted | ||
|
||
Some errors have detailed explanations: E0405, E0412, E0658. | ||
For more information about an error, try `rustc --explain E0405`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated error minimization: