@@ -35,6 +35,7 @@ use rustc::hir;
3535use rustc:: hir:: def_id:: { CRATE_DEF_INDEX , DefId } ;
3636use rustc:: hir:: intravisit as visit;
3737use rustc:: ty:: TyCtxt ;
38+ use rustc:: util:: nodemap:: DefIdMap ;
3839use rustc_data_structures:: fnv:: FnvHashMap ;
3940
4041use self :: svh_visitor:: StrictVersionHashVisitor ;
@@ -47,7 +48,9 @@ pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
4748 -> IncrementalHashesMap {
4849 let _ignore = tcx. dep_graph . in_ignore ( ) ;
4950 let krate = tcx. map . krate ( ) ;
50- let mut visitor = HashItemsVisitor { tcx : tcx, hashes : FnvHashMap ( ) } ;
51+ let mut visitor = HashItemsVisitor { tcx : tcx,
52+ hashes : FnvHashMap ( ) ,
53+ def_path_hashes : DefIdMap ( ) } ;
5154 visitor. calculate_def_id ( DefId :: local ( CRATE_DEF_INDEX ) , |v| visit:: walk_crate ( v, krate) ) ;
5255 krate. visit_all_items ( & mut visitor) ;
5356 visitor. compute_crate_hash ( ) ;
@@ -56,6 +59,7 @@ pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
5659
5760struct HashItemsVisitor < ' a , ' tcx : ' a > {
5861 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
62+ def_path_hashes : DefIdMap < u64 > ,
5963 hashes : IncrementalHashesMap ,
6064}
6165
@@ -75,7 +79,9 @@ impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> {
7579 // FIXME: this should use SHA1, not SipHash. SipHash is not
7680 // built to avoid collisions.
7781 let mut state = SipHasher :: new ( ) ;
78- walk_op ( & mut StrictVersionHashVisitor :: new ( & mut state, self . tcx ) ) ;
82+ walk_op ( & mut StrictVersionHashVisitor :: new ( & mut state,
83+ self . tcx ,
84+ & mut self . def_path_hashes ) ) ;
7985 let item_hash = state. finish ( ) ;
8086 self . hashes . insert ( DepNode :: Hir ( def_id) , item_hash) ;
8187 debug ! ( "calculate_item_hash: def_id={:?} hash={:?}" , def_id, item_hash) ;
0 commit comments