Lint against non-NFC items? #120723
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-Unicode
Area: Unicode
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
Spinoff of #120697
Not the same as
uncommon_codepoints
! We NFC-normalize idents, as described in RFC #2457. In the (admittedly unlikely) case where someone actually includes an ident that is normalized to match another ident, this can result in a "you wrote (or more likely, mechanically emitted) something, then a nuance of that got silently ignored by the compiler, and now get compiler errors". Only a very, very unusual source file would want to even try to separately include both the NFD and NFC forms of an ident, and I think this would only happen due to machine-generated code or multiple splat-includes, so this is no harm done in reality. But "the byte strings for two idents can not match, yet still resolve to the same value" can still be surprising, especially to reason about in the machine-generation case where a programmer is likely to reason significantly about equating identifiers and strings, so we could probably emit a warning when we normalize an ident in a source file and it results in an actual difference, much like we emit warnings when we leave other data unused.Other cases
No response
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: