Rustc oddities
NFC normalisation for lifetime/label
Identifiers are normalised to NFC,
which means that Kelvin
and Kelvin
are treated as representing the same identifier.
See rfc2457.
But this doesn't happen for lifetimes or labels, so 'Kelvin
and 'Kelvin
are different as lifetimes or labels.
For example, this compiles without warning in Rust 1.83, while this doesn't.
In this writeup, the represented identifier attribute of Identifier
and RawIdentifier
fine-grained tokens is in NFC,
and the name attribute of LifetimeOrLabel
and RawLifetimeOrLabel
tokens isn't.
I think this behaviour is a promising candidate for provoking the "Wait...that's what we currently do? We should fix that." reaction to being given a spec to review.
Filed as rustc #126759.
Restriction on e-suffixes
With the implementation of pr131656 as of 2025-03-02, support for numeric literal suffixes beginning with e or E is incomplete, and rejects some (very obscure) cases.
A numeric literal token is rejected if:
- it doesn't have an exponent; and
- it has a suffix of the following form:
- begins with e or E
- immediately followed by one or more _ characters
- immediately followed by a character which has the
XID_Continue
property but notXID_Start
.
For example, 123e_·
is rejected.