@@ -113,7 +113,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
113
113
} ,
114
114
( & ExprKind :: Match ( ref le, ref la, ref ls) , & ExprKind :: Match ( ref re, ref ra, ref rs) ) => {
115
115
ls == rs && self . eq_expr ( le, re) && over ( la, ra, |l, r| {
116
- self . eq_expr ( & l. body , & r. body ) && both ( & l. guard , & r. guard , |l, r| self . eq_expr ( l, r) )
116
+ self . eq_expr ( & l. body , & r. body ) && both ( & l. guard , & r. guard , |l, r| self . eq_guard ( l, r) )
117
117
&& over ( & l. pats , & r. pats , |l, r| self . eq_pat ( l, r) )
118
118
} )
119
119
} ,
@@ -152,6 +152,12 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
152
152
left. ident . name == right. ident . name && self . eq_expr ( & left. expr , & right. expr )
153
153
}
154
154
155
+ fn eq_guard ( & mut self , left : & Guard , right : & Guard ) -> bool {
156
+ match ( left, right) {
157
+ ( Guard :: If ( l) , Guard :: If ( r) ) => self . eq_expr ( l, r) ,
158
+ }
159
+ }
160
+
155
161
fn eq_generic_arg ( & mut self , left : & GenericArg , right : & GenericArg ) -> bool {
156
162
match ( left, right) {
157
163
( GenericArg :: Lifetime ( l_lt) , GenericArg :: Lifetime ( r_lt) ) => self . eq_lifetime ( l_lt, r_lt) ,
@@ -497,7 +503,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
497
503
for arm in arms {
498
504
// TODO: arm.pat?
499
505
if let Some ( ref e) = arm. guard {
500
- self . hash_expr ( e) ;
506
+ self . hash_guard ( e) ;
501
507
}
502
508
self . hash_expr ( & arm. body ) ;
503
509
}
@@ -637,4 +643,14 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
637
643
} ,
638
644
}
639
645
}
646
+
647
+ pub fn hash_guard ( & mut self , g : & Guard ) {
648
+ match g {
649
+ Guard :: If ( ref expr) => {
650
+ let c: fn ( _) -> _ = Guard :: If ;
651
+ c. hash ( & mut self . s ) ;
652
+ self . hash_expr ( expr) ;
653
+ }
654
+ }
655
+ }
640
656
}
0 commit comments