@@ -119,6 +119,7 @@ mod svh_visitor {
119119 use rustc:: ty:: TyCtxt ;
120120 use rustc:: hir;
121121 use rustc:: hir:: * ;
122+ use rustc:: hir:: map:: DefPath ;
122123 use rustc:: hir:: intravisit as visit;
123124 use rustc:: hir:: intravisit:: { Visitor , FnKind } ;
124125
@@ -135,6 +136,15 @@ mod svh_visitor {
135136 -> Self {
136137 StrictVersionHashVisitor { st : st, tcx : tcx }
137138 }
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+ }
138148 }
139149
140150 // To off-load the bulk of the hash-computation on #[derive(Hash)],
@@ -289,9 +299,9 @@ mod svh_visitor {
289299
290300 impl < ' a , ' tcx > Visitor < ' a > for StrictVersionHashVisitor < ' a , ' tcx > {
291301 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 ) ;
295305 }
296306
297307 fn visit_variant_data ( & mut self , s : & ' a VariantData , name : Name ,
0 commit comments