Skip to content

NFC normalisation of lifetimes and labels #126759

Open
@mattheww

Description

@mattheww

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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UnicodeArea: UnicodeT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions