-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
pub fn f(
_: impl Iterator<Item=&str>,
) {}Current output
error[E0658]: anonymous lifetimes in `impl Trait` are unstable
--> src/lib.rs:2:28
|
2 | _: impl Iterator<Item=&str>,
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
1 ~ pub fn f<'a>(
2 ~ _: impl Iterator<Item=&'a str>,
|Desired output
error[E0658]: anonymous lifetimes in `impl Trait` are unstable
--> src/lib.rs:2:28
|
2 | _: impl Iterator<Item=&str>,
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
1 ~ pub fn f<'a>(
2 ~ _: impl Iterator<Item=&'a str>,
|
help: note that this is allowed in async fn, due to a ??bug or something??
see ticket https://github.com/rust-lang/rust/issues/108468Rationale and extra context
I was just refactoring some code and broke out a sync function from an async one, with many of the same arguments. The compiler tells me that the anonymous lifetimes aren't allowed - but of course they were.
Other cases
This one compiles.
pub async fn f(
_: impl Iterator<Item=&str>,
) {}Rust Version
Today's playground, stable.
Anything else?
This anomaly has persisted for two and a half years. Presumably it's not going to be fixed soon.
In the meantime, we could avoid gaslighting the poor user..
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.