-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
NFC normalisation of lifetimes and labels #126759
Copy link
Copy link
Closed
Labels
A-UnicodeArea: UnicodeArea: UnicodeT-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.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-UnicodeArea: UnicodeArea: UnicodeT-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.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
The lexer NFC-normalises identifiers, as described in rfc2457. For example,
K(LATIN CAPITAL LETTER K) andK(KELVIN SIGN) are treated as representing the same identifier.But this doesn't happen for lifetimes or labels, so
'Kand'Kare different as lifetimes or labels.For example, this compiles (without warning) in Rust 1.79, while this doesn't compile.
I'm not sure whether this should be considered a bug.
rfc2457 doesn't explicitly mention lifetimes or labels.
The Reference describes the current behaviour: it treats identifiers and lifetimes/labels as parallel forms of token, and documents normalisation as happening for identifiers only.
On the other hand it seems surprising, and some of the discussion around #126452 has expressed the view that "lifetimes are identifiers".