-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Confusing error when using non-XID_Start characters in lifetime names #141081
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lexerArea: lexerArea: lexerD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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-lexerArea: lexerArea: lexerD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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
See also https://doc.rust-lang.org/reference/identifiers.html.
Initially reported at #general > Compiler isn't helpful with invalid lifetimes.
Looks like this recovery path(?) is hit when starting a lifetime name (not including the
') with a non-XID_Startcharacter fails bothis_id_startcheck and ASCII digit check hitting the!can_be_a_lifetimecodepath.rust/compiler/rustc_lexer/src/lib.rs
Lines 824 to 842 in c79bbfa
Other cases
Marginally related is loop labels, this complains about "unterminated character literal".
Rust Version
Anything else?
No response