@@ -3,7 +3,7 @@ use rustc::lint::*;
3
3
use rustc:: hir:: * ;
4
4
use std:: hash:: { Hash , Hasher } ;
5
5
use std:: collections:: hash_map:: DefaultHasher ;
6
- use syntax:: ast:: { Name , NodeId } ;
6
+ use syntax:: ast:: Name ;
7
7
use syntax:: ptr:: P ;
8
8
use utils:: differing_macro_contexts;
9
9
@@ -100,13 +100,14 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
100
100
self . eq_expr ( lc, rc) && self . eq_block ( lt, rt) && both ( le, re, |l, r| self . eq_expr ( l, r) )
101
101
}
102
102
( & ExprLit ( ref l) , & ExprLit ( ref r) ) => l. node == r. node ,
103
- ( & ExprLoop ( ref lb, ref ll, _ ) , & ExprLoop ( ref rb, ref rl, _ ) ) => {
104
- self . eq_block ( lb, rb) && both ( ll, rl, |l, r| l. node . as_str ( ) == r. node . as_str ( ) )
103
+ ( & ExprLoop ( ref lb, ref ll, ref lls ) , & ExprLoop ( ref rb, ref rl, ref rls ) ) => {
104
+ lls == rls && self . eq_block ( lb, rb) && both ( ll, rl, |l, r| l. node . as_str ( ) == r. node . as_str ( ) )
105
105
}
106
106
( & ExprMatch ( ref le, ref la, ref ls) , & ExprMatch ( ref re, ref ra, ref rs) ) => {
107
107
ls == rs && self . eq_expr ( le, re) &&
108
108
over ( la, ra, |l, r| {
109
- self . eq_expr ( & l. body , & r. body ) && both ( & l. guard , & r. guard , |l, r| self . eq_expr ( l, r) ) &&
109
+ self . eq_expr ( & l. body , & r. body ) &&
110
+ both ( & l. guard , & r. guard , |l, r| self . eq_expr ( l, r) ) &&
110
111
over ( & l. pats , & r. pats , |l, r| self . eq_pat ( l, r) )
111
112
} )
112
113
}
@@ -153,8 +154,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
153
154
( & PatKind :: TupleStruct ( ref lp, ref la, ls) , & PatKind :: TupleStruct ( ref rp, ref ra, rs) ) => {
154
155
self . eq_qpath ( lp, rp) && over ( la, ra, |l, r| self . eq_pat ( l, r) ) && ls == rs
155
156
}
156
- ( & PatKind :: Binding ( ref lb, ref ld , ref li, ref lp) , & PatKind :: Binding ( ref rb, ref rd , ref ri, ref rp) ) => {
157
- lb == rb && ld == rd && li. node . as_str ( ) == ri. node . as_str ( ) && both ( lp, rp, |l, r| self . eq_pat ( l, r) )
157
+ ( & PatKind :: Binding ( ref lb, _ , ref li, ref lp) , & PatKind :: Binding ( ref rb, _ , ref ri, ref rp) ) => {
158
+ lb == rb && li. node . as_str ( ) == ri. node . as_str ( ) && both ( lp, rp, |l, r| self . eq_pat ( l, r) )
158
159
}
159
160
( & PatKind :: Path ( ref l) , & PatKind :: Path ( ref r) ) => self . eq_qpath ( l, r) ,
160
161
( & PatKind :: Lit ( ref l) , & PatKind :: Lit ( ref r) ) => self . eq_expr ( l, r) ,
@@ -456,13 +457,13 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
456
457
ExprPath ( ref qpath) => {
457
458
let c: fn ( _) -> _ = ExprPath ;
458
459
c. hash ( & mut self . s ) ;
459
- self . hash_qpath ( qpath, e . id ) ;
460
+ self . hash_qpath ( qpath) ;
460
461
}
461
462
ExprStruct ( ref path, ref fields, ref expr) => {
462
463
let c: fn ( _, _, _) -> _ = ExprStruct ;
463
464
c. hash ( & mut self . s ) ;
464
465
465
- self . hash_qpath ( path, e . id ) ;
466
+ self . hash_qpath ( path) ;
466
467
467
468
for f in fields {
468
469
self . hash_name ( & f. name . node ) ;
@@ -527,8 +528,16 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
527
528
n. as_str ( ) . hash ( & mut self . s ) ;
528
529
}
529
530
530
- pub fn hash_qpath ( & mut self , p : & QPath , id : NodeId ) {
531
- self . cx . tcx . tables ( ) . qpath_def ( p, id) . hash ( & mut self . s ) ;
531
+ pub fn hash_qpath ( & mut self , p : & QPath ) {
532
+ match * p {
533
+ QPath :: Resolved ( _, ref path) => {
534
+ self . hash_path ( path) ;
535
+ }
536
+ QPath :: TypeRelative ( _, ref path) => {
537
+ self . hash_name ( & path. name ) ;
538
+ }
539
+ }
540
+ //self.cx.tcx.tables().qpath_def(p, id).hash(&mut self.s);
532
541
}
533
542
534
543
pub fn hash_path ( & mut self , p : & Path ) {
0 commit comments