@@ -22,8 +22,7 @@ pub enum CommentKind {
2222 Block ,
2323}
2424
25- // This type must not implement `Hash` due to the unusual `PartialEq` impl below.
26- #[ derive( Copy , Clone , Debug , Encodable , Decodable , HashStable_Generic ) ]
25+ #[ derive( Copy , Clone , PartialEq , Debug , Encodable , Decodable , HashStable_Generic ) ]
2726pub enum InvisibleOrigin {
2827 // From the expansion of a metavariable in a declarative macro.
2928 MetaVar ( MetaVarKind ) ,
@@ -45,20 +44,6 @@ impl InvisibleOrigin {
4544 }
4645}
4746
48- impl PartialEq for InvisibleOrigin {
49- #[ inline]
50- fn eq ( & self , _other : & InvisibleOrigin ) -> bool {
51- // When we had AST-based nonterminals we couldn't compare them, and the
52- // old `Nonterminal` type had an `eq` that always returned false,
53- // resulting in this restriction:
54- // https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment
55- // This `eq` emulates that behaviour. We could consider lifting this
56- // restriction now but there are still cases involving invisible
57- // delimiters that make it harder than it first appears.
58- false
59- }
60- }
61-
6247/// Annoyingly similar to `NonterminalKind`, but the slight differences are important.
6348#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
6449pub enum MetaVarKind {
@@ -142,7 +127,8 @@ impl Delimiter {
142127 }
143128 }
144129
145- // This exists because `InvisibleOrigin`s should be compared. It is only used for assertions.
130+ // This exists because `InvisibleOrigin`s should not be compared. It is only used for
131+ // assertions.
146132 pub fn eq_ignoring_invisible_origin ( & self , other : & Delimiter ) -> bool {
147133 match ( self , other) {
148134 ( Delimiter :: Parenthesis , Delimiter :: Parenthesis ) => true ,
0 commit comments