@@ -35,6 +35,7 @@ use rustc::hir;
35
35
use rustc:: hir:: def_id:: { CRATE_DEF_INDEX , DefId } ;
36
36
use rustc:: hir:: intravisit as visit;
37
37
use rustc:: ty:: TyCtxt ;
38
+ use rustc:: util:: nodemap:: DefIdMap ;
38
39
use rustc_data_structures:: fnv:: FnvHashMap ;
39
40
40
41
use self :: svh_visitor:: StrictVersionHashVisitor ;
@@ -47,7 +48,9 @@ pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
47
48
-> IncrementalHashesMap {
48
49
let _ignore = tcx. dep_graph . in_ignore ( ) ;
49
50
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 ( ) } ;
51
54
visitor. calculate_def_id ( DefId :: local ( CRATE_DEF_INDEX ) , |v| visit:: walk_crate ( v, krate) ) ;
52
55
krate. visit_all_items ( & mut visitor) ;
53
56
visitor. compute_crate_hash ( ) ;
@@ -56,6 +59,7 @@ pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
56
59
57
60
struct HashItemsVisitor < ' a , ' tcx : ' a > {
58
61
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
62
+ def_path_hashes : DefIdMap < u64 > ,
59
63
hashes : IncrementalHashesMap ,
60
64
}
61
65
@@ -75,7 +79,9 @@ impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> {
75
79
// FIXME: this should use SHA1, not SipHash. SipHash is not
76
80
// built to avoid collisions.
77
81
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 ) ) ;
79
85
let item_hash = state. finish ( ) ;
80
86
self . hashes . insert ( DepNode :: Hir ( def_id) , item_hash) ;
81
87
debug ! ( "calculate_item_hash: def_id={:?} hash={:?}" , def_id, item_hash) ;
0 commit comments