-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
'r#_ gives two confusingly similar errors #143152
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Current output
Desired output
Rationale and extra context
I believe the first diagnostic is from the lexer, and the second diagnostic occurs in parsing.
These diagnostics technically don't communicate the same information:
'r#_was a valid token (in which case it would be a synonym of'_, similar to'r#static), it would not be allowed in this position.But both boil down to "this isn't allowed" without any suggestion for how to change it. And the second diagnostic is really about a hypothetical synonym to
'r#_, but because that token is invalid, it has no synonyms.So, i think the best alternative would be to only display the error saying that
"`_` cannot be a raw lifetime"Rust Version