-
Notifications
You must be signed in to change notification settings - Fork 898
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
Consider NFC normalization of idents? #6058
Comments
I don't see how? |
@Jules-Bertholet Wait, maybe my brain is just slow (I'm overdue for lunch...), does rustc fully NFC-normalize idents internally when resolving them? |
Yes. |
Oh, no issue then! In fact it would help motivate rustc linting since then we could just expect people to run rustfmt. |
@Jules-Bertholet @workingjubilee Do either of you know if there are crates that already implement the normalization? |
@Jules-Bertholet Ahhh nice! Very good to know that something like this already exists. Thanks for the link.
Just want to make sure I understand correctly. Neither of you think this would be an issue? |
Correct, AIUI. Even if a dependency uses non-NFC idents internally, they can be referred to by dependents with their NFC forms. |
Yes. I was a bit slow on the uptake and hadn't remembered yet that we NFC idents (because of course we should). Applying NFC on format means that the visual appearance of the normalized identifiers will not be changed as a result. |
Thank you both for the confirmation. In that case, I think we could add an opt-in configuration option to normalize idents. I'm pretty sure all idents get rewritten in Lines 27 to 29 in ead0fc9
Probably makes sense to return a |
Raised by @Jules-Bertholet in rust-lang/rust#120697
It could be desirable to NFC-normalize identifiers so as to remove these kinds of inconsistencies.
However, it seems plausible that this may cause issues if the identifiers are not local, e.g. they come from another crate that does not run rustfmt.
It may make sense, however, if rustc itself linted against non-NFC-normalized idents?
The text was updated successfully, but these errors were encountered: