-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Replace Idents with Names outside of libsyntax + Idents/Names cleanup (Part 2) #28642
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
Conversation
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
|
Could you file issues for the remaining work you identified please? (It sounds really useful and I wouldn't want it to be forgotten). |
|
@bors: r+ |
|
📌 Commit f284cbc has been approved by |
|
@nrc |
This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky. Although this PR closes #6993 there's still work related to it: - `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions. - Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons. - Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts. r? @nrc
|
Why was |
|
@Manishearth |
|
Yeah, but if it's doing something that should be explicit that's fine by me. |
This PR removes random remaining
Idents outside of libsyntax and performs general cleanupIn particular, interfaces of
NameandIdentare tidied up,Names andIdents being smallCopyaggregates are always passed to functions by value, andIdents are never used as keys in maps, becauseIdentcomparisons are tricky.Although this PR closes #6993 there's still work related to it:
Namecan be madeNonZeroto compress numerousOption<Name>s andOption<Ident>s but it requires const unsafe functions.PartialEqonIdentshould be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons.Names in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts.r? @nrc