@@ -491,7 +491,7 @@ impl DisplayWithPartialPaths for PartialScopedSymbol {
491491/// A pattern that might match against a symbol stack. Consists of a (possibly empty) list of
492492/// partial scoped symbols, along with an optional symbol stack variable.
493493#[ repr( C ) ]
494- #[ derive( Clone , Copy ) ]
494+ #[ derive( Clone , Copy , Eq , Hash , PartialEq ) ]
495495pub struct PartialSymbolStack {
496496 symbols : ReversibleList < PartialScopedSymbol > ,
497497 length : u32 ,
@@ -791,24 +791,13 @@ impl PartialSymbolStack {
791791 unreachable ! ( ) ;
792792 }
793793
794- pub fn equals ( mut self , partials : & mut PartialPaths , mut other : PartialSymbolStack ) -> bool {
795- while let Some ( self_symbol) = self . pop_front ( partials) {
796- if let Some ( other_symbol) = other. pop_front ( partials) {
797- if !self_symbol. equals ( partials, & other_symbol) {
798- return false ;
799- }
800- } else {
801- return false ;
802- }
803- }
804- if !other. symbols . is_empty ( ) {
805- return false ;
806- }
807- equals_option (
808- self . variable . into_option ( ) ,
809- other. variable . into_option ( ) ,
810- |a, b| a == b,
811- )
794+ pub fn equals ( self , _partials : & mut PartialPaths , other : PartialSymbolStack ) -> bool {
795+ self . symbols == other. symbols
796+ && equals_option (
797+ self . variable . into_option ( ) ,
798+ other. variable . into_option ( ) ,
799+ |a, b| a == b,
800+ )
812801 }
813802
814803 pub fn cmp (
@@ -1204,11 +1193,8 @@ impl PartialScopeStack {
12041193 self . variable . into_option ( )
12051194 }
12061195
1207- pub fn equals ( self , partials : & mut PartialPaths , other : PartialScopeStack ) -> bool {
1208- self . scopes
1209- . equals_with ( & mut partials. partial_scope_stacks , other. scopes , |a, b| {
1210- * a == * b
1211- } )
1196+ pub fn equals ( self , _partials : & mut PartialPaths , other : PartialScopeStack ) -> bool {
1197+ self . scopes == other. scopes
12121198 && equals_option (
12131199 self . variable . into_option ( ) ,
12141200 other. variable . into_option ( ) ,
@@ -1852,21 +1838,13 @@ impl PartialPath {
18521838 self . edges . shadows ( partials, other. edges )
18531839 }
18541840
1855- pub fn equals ( & self , partials : & mut PartialPaths , other : & PartialPath ) -> bool {
1841+ pub fn equals ( & self , _partials : & mut PartialPaths , other : & PartialPath ) -> bool {
18561842 self . start_node == other. start_node
18571843 && self . end_node == other. end_node
1858- && self
1859- . symbol_stack_precondition
1860- . equals ( partials, other. symbol_stack_precondition )
1861- && self
1862- . symbol_stack_postcondition
1863- . equals ( partials, other. symbol_stack_postcondition )
1864- && self
1865- . scope_stack_precondition
1866- . equals ( partials, other. scope_stack_precondition )
1867- && self
1868- . scope_stack_postcondition
1869- . equals ( partials, other. scope_stack_postcondition )
1844+ && self . symbol_stack_precondition == other. symbol_stack_precondition
1845+ && self . symbol_stack_postcondition == other. symbol_stack_postcondition
1846+ && self . scope_stack_precondition == other. scope_stack_precondition
1847+ && self . scope_stack_postcondition == other. scope_stack_postcondition
18701848 }
18711849
18721850 pub fn cmp (
0 commit comments