-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Stop errorring for elided lifetimes in path. #96957
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
---|---|---|
@@ -1,15 +1,29 @@ | ||
error[E0726]: implicit elided lifetime not allowed here | ||
--> $DIR/async-fn-path-elision.rs:5:20 | ||
error: hidden lifetime parameters in types are deprecated | ||
--> $DIR/async-fn-path-elision.rs:6:20 | ||
| | ||
LL | async fn error(lt: HasLifetime) { | ||
| ^^^^^^^^^^^ expected lifetime parameter | ||
| | ||
= note: assuming a `'static` lifetime... | ||
note: the lint level is defined here | ||
--> $DIR/async-fn-path-elision.rs:2:9 | ||
| | ||
LL | #![deny(elided_lifetimes_in_paths)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
help: indicate the anonymous lifetime | ||
| | ||
LL | async fn error(lt: HasLifetime<'_>) { | ||
| ++++ | ||
|
||
error: aborting due to previous error | ||
error: hidden lifetime parameters in types are deprecated | ||
--> $DIR/async-fn-path-elision.rs:10:19 | ||
| | ||
LL | fn also_error(lt: HasLifetime) { | ||
| ^^^^^^^^^^^ expected lifetime parameter | ||
| | ||
help: indicate the anonymous lifetime | ||
| | ||
LL | fn also_error(lt: HasLifetime<'_>) { | ||
| ++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0726`. |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#![allow(warnings)] | ||
#![deny(elided_lifetimes_in_paths)] | ||
|
||
trait MyTrait { } | ||
|
||
struct Foo<'a> { x: &'a u32 } | ||
|
||
impl MyTrait for Foo { | ||
//~^ ERROR implicit elided lifetime not allowed here | ||
//~^ ERROR hidden lifetime parameters in types are deprecated [elided_lifetimes_in_paths] | ||
} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
error[E0726]: implicit elided lifetime not allowed here | ||
error: hidden lifetime parameters in types are deprecated | ||
--> $DIR/path-elided.rs:7:18 | ||
| | ||
LL | impl MyTrait for Foo { | ||
| ^^^ expected lifetime parameter | ||
| | ||
= note: assuming a `'static` lifetime... | ||
note: the lint level is defined here | ||
--> $DIR/path-elided.rs:1:9 | ||
| | ||
LL | #![deny(elided_lifetimes_in_paths)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
help: indicate the anonymous lifetime | ||
| | ||
LL | impl MyTrait for Foo<'_> { | ||
| ++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0726`. |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#![allow(warnings)] | ||
#![deny(elided_lifetimes_in_paths)] | ||
|
||
trait MyTrait<'a> {} | ||
|
||
impl MyTrait for u32 {} | ||
//~^ ERROR implicit elided lifetime not allowed here | ||
//~^ ERROR hidden lifetime parameters in types are deprecated [elided_lifetimes_in_paths] | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
error[E0726]: implicit elided lifetime not allowed here | ||
error: hidden lifetime parameters in types are deprecated | ||
--> $DIR/trait-elided.rs:5:6 | ||
| | ||
LL | impl MyTrait for u32 {} | ||
| ^^^^^^^ expected lifetime parameter | ||
| | ||
= note: assuming a `'static` lifetime... | ||
note: the lint level is defined here | ||
--> $DIR/trait-elided.rs:1:9 | ||
| | ||
LL | #![deny(elided_lifetimes_in_paths)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
help: indicate the anonymous lifetime | ||
| | ||
LL | impl MyTrait<'_> for u32 {} | ||
| ++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0726`. |
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
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
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.
It's surprising that this change is only picked up in this test. I would have expected it to be picked up in a parsing or lowering test or something.
Regardless, this change will need a lang (probably) FCP. FWIW, I personally don't think allowing elided lifetimes in
impl
headers is the right move. It's 1) inconsistent with the general trend of not allow elided lifetime parameters and 2) unspecified on if it would be'static
(as is assumed today under error conditions or some new lifetime (which would be the case if you did'_
.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.
I'm also maybe a bit confused here. I guess the
ELIDED_LIFETIMES_IN_PATHS
lint is allow by default, but was erroring. Is that what you're cleaning up?