-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST
Description
Spawned from #28642
There's no one true way to compare Idents. They can be compared non-hygienically (id1.name == id2.name), hygienically (mtwt::resolve(id1) == mtwt::resolve(id2)), or even member-wise (id1.name == id2.name && id1.ctxt== id2.ctxt) depending on the situation.
Currently PartialEq for Idents compares only names (non-hygienic comparison), but panics if the contexts are different. Hash for idents is not consistent with PartialEq and hashes both name and context of an Ident leading, it can lead to rare random panics if Idents are used as keys in HashMaps.
One solution is to remove implementations of PartialEq and Hash from Ident and use necessary versions of comparisons explicitly.
Metadata
Metadata
Assignees
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST