Skip to content
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

NFC normalisation of lifetimes and labels #126759

Open
mattheww opened this issue Jun 20, 2024 · 0 comments
Open

NFC normalisation of lifetimes and labels #126759

mattheww opened this issue Jun 20, 2024 · 0 comments
Labels
A-Unicode Area: Unicode T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@mattheww
Copy link
Contributor

The lexer NFC-normalises identifiers, as described in rfc2457. For example, K (LATIN CAPITAL LETTER K) and (KELVIN SIGN) are treated as representing the same identifier.

But this doesn't happen for lifetimes or labels, so 'K and 'K are 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".

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 20, 2024
@workingjubilee workingjubilee added T-lang Relevant to the language team, which will review and decide on the PR/issue. A-Unicode Area: Unicode T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 22, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Unicode Area: Unicode T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants