@@ -3,7 +3,7 @@ use crate::utils::differing_macro_contexts;
3
3
use rustc:: hir:: ptr:: P ;
4
4
use rustc:: hir:: * ;
5
5
use rustc:: lint:: LateContext ;
6
- use rustc:: ty:: { Ty , TypeckTables } ;
6
+ use rustc:: ty:: { self , Ty , TypeckTables } ;
7
7
use std:: collections:: hash_map:: DefaultHasher ;
8
8
use std:: hash:: { Hash , Hasher } ;
9
9
use syntax:: ast:: Name ;
@@ -45,7 +45,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
45
45
match ( & left. node , & right. node ) {
46
46
( & StmtKind :: Local ( ref l) , & StmtKind :: Local ( ref r) ) => {
47
47
self . eq_pat ( & l. pat , & r. pat )
48
- && both ( & l. ty , & r. ty , |l, r| self . eq_ty ( l, r) )
48
+ && both ( & l. ty , & r. ty , |l, r| self . eq_ty ( * l, * r) )
49
49
&& both ( & l. init , & r. init , |l, r| self . eq_expr ( l, r) )
50
50
} ,
51
51
( & StmtKind :: Expr ( ref l) , & StmtKind :: Expr ( ref r) ) | ( & StmtKind :: Semi ( ref l) , & StmtKind :: Semi ( ref r) ) => {
@@ -257,7 +257,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
257
257
}
258
258
}
259
259
260
- pub fn eq_ty ( & mut self , left : & Ty , right : & Ty ) -> bool {
260
+ pub fn eq_ty ( & mut self , left : & Ty < ' tcx > , right : & Ty < ' tcx > ) -> bool {
261
261
self . eq_ty_kind ( & left. node , & right. node )
262
262
}
263
263
@@ -604,26 +604,26 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
604
604
}
605
605
}
606
606
607
- pub fn hash_ty ( & mut self , ty : & Ty ) {
607
+ pub fn hash_ty ( & mut self , ty : & Ty < ' tcx > ) {
608
608
std:: mem:: discriminant ( & ty. node ) . hash ( & mut self . s ) ;
609
- match ty. node {
610
- Ty :: Slice ( ty) => {
609
+ match ty. sty {
610
+ ty :: Slice ( ty) => {
611
611
self . hash_ty ( ty) ;
612
612
} ,
613
- Ty :: Array ( ty, anon_const) => {
613
+ ty :: Array ( ty, anon_const) => {
614
614
self . hash_ty ( ty) ;
615
615
self . hash_expr ( & self . cx . tcx . hir ( ) . body ( anon_const. body ) . value ) ;
616
616
} ,
617
- Ty :: Ptr ( mut_ty) => {
617
+ ty :: Ptr ( mut_ty) => {
618
618
self . hash_ty ( & mut_ty. ty ) ;
619
619
mut_ty. mutbl . hash ( & mut self . s ) ;
620
620
} ,
621
- Ty :: Rptr ( lifetime, mut_ty) => {
621
+ ty :: Rptr ( lifetime, mut_ty) => {
622
622
self . hash_lifetime ( lifetime) ;
623
623
self . hash_ty ( & mut_ty. ty ) ;
624
624
mut_ty. mutbl . hash ( & mut self . s ) ;
625
625
} ,
626
- Ty :: BareFn ( bfn) => {
626
+ ty :: BareFn ( bfn) => {
627
627
bfn. unsafety . hash ( & mut self . s ) ;
628
628
bfn. abi . hash ( & mut self . s ) ;
629
629
for arg in & bfn. decl . inputs {
@@ -639,13 +639,13 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
639
639
}
640
640
bfn. decl . c_variadic . hash ( & mut self . s ) ;
641
641
} ,
642
- Ty :: Tup ( ty_list) => {
642
+ ty :: Tup ( ty_list) => {
643
643
for ty in ty_list {
644
644
self . hash_ty ( ty) ;
645
645
}
646
646
647
647
} ,
648
- Ty :: Path ( qpath) => {
648
+ ty :: Path ( qpath) => {
649
649
match qpath {
650
650
QPath :: Resolved ( ref maybe_ty, ref path) => {
651
651
if let Some ( ref ty) = maybe_ty {
@@ -661,7 +661,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
661
661
} ,
662
662
}
663
663
} ,
664
- Ty :: Def ( _, arg_list) => {
664
+ ty :: Def ( _, arg_list) => {
665
665
for arg in arg_list {
666
666
match arg {
667
667
GenericArg :: Lifetime ( ref l) => self . hash_lifetime ( l) ,
@@ -672,17 +672,17 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
672
672
}
673
673
}
674
674
} ,
675
- Ty :: TraitObject ( _, lifetime) => {
675
+ ty :: TraitObject ( _, lifetime) => {
676
676
self . hash_lifetime ( lifetime) ;
677
677
678
678
} ,
679
- Ty :: Typeof ( anon_const) => {
679
+ ty :: Typeof ( anon_const) => {
680
680
self . hash_expr ( & self . cx . tcx . hir ( ) . body ( anon_const. body ) . value ) ;
681
681
} ,
682
- Ty :: CVarArgs ( lifetime) => {
682
+ ty :: CVarArgs ( lifetime) => {
683
683
self . hash_lifetime ( lifetime) ;
684
684
} ,
685
- Ty :: Err | Ty :: Infer | Ty :: Never => { } ,
685
+ ty :: Err | ty :: Infer | ty :: Never => { } ,
686
686
}
687
687
}
688
688
}
0 commit comments