@@ -119,6 +119,7 @@ mod svh_visitor {
119
119
use rustc:: ty:: TyCtxt ;
120
120
use rustc:: hir;
121
121
use rustc:: hir:: * ;
122
+ use rustc:: hir:: map:: DefPath ;
122
123
use rustc:: hir:: intravisit as visit;
123
124
use rustc:: hir:: intravisit:: { Visitor , FnKind } ;
124
125
@@ -135,6 +136,15 @@ mod svh_visitor {
135
136
-> Self {
136
137
StrictVersionHashVisitor { st : st, tcx : tcx }
137
138
}
139
+
140
+ fn hash_def_path ( & mut self , path : & DefPath ) {
141
+ self . tcx . crate_name ( path. krate ) . hash ( self . st ) ;
142
+ self . tcx . crate_disambiguator ( path. krate ) . hash ( self . st ) ;
143
+ for data in & path. data {
144
+ data. data . as_interned_str ( ) . hash ( self . st ) ;
145
+ data. disambiguator . hash ( self . st ) ;
146
+ }
147
+ }
138
148
}
139
149
140
150
// To off-load the bulk of the hash-computation on #[derive(Hash)],
@@ -289,9 +299,9 @@ mod svh_visitor {
289
299
290
300
impl < ' a , ' tcx > Visitor < ' a > for StrictVersionHashVisitor < ' a , ' tcx > {
291
301
fn visit_nested_item ( & mut self , item : ItemId ) {
292
- debug ! ( "visit_nested_item: {:?} st={:?}" , item , self . st ) ;
293
- let def_path = self . tcx . map . def_path_from_id ( item . id ) ;
294
- def_path . hash ( self . st ) ;
302
+ let def_path = self . tcx . map . def_path_from_id ( item . id ) . unwrap ( ) ;
303
+ debug ! ( "visit_nested_item: def_path={:?} st={:?}" , def_path , self . st ) ;
304
+ self . hash_def_path ( & def_path ) ;
295
305
}
296
306
297
307
fn visit_variant_data ( & mut self , s : & ' a VariantData , name : Name ,
0 commit comments