@@ -13,6 +13,7 @@ use dep_graph::{DepGraph, DepKind, DepNodeIndex};
13
13
use hir:: def_id:: { LOCAL_CRATE , CrateNum } ;
14
14
use hir:: intravisit:: { Visitor , NestedVisitorMap } ;
15
15
use hir:: svh:: Svh ;
16
+ use ich:: Fingerprint ;
16
17
use middle:: cstore:: CrateStore ;
17
18
use session:: CrateDisambiguator ;
18
19
use std:: iter:: repeat;
@@ -121,21 +122,24 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
121
122
collector
122
123
}
123
124
124
- pub ( super ) fn finalize_and_compute_crate_hash ( self ,
125
+ pub ( super ) fn finalize_and_compute_crate_hash ( mut self ,
125
126
crate_disambiguator : CrateDisambiguator ,
126
127
cstore : & CrateStore ,
127
128
codemap : & CodeMap ,
128
129
commandline_args_hash : u64 )
129
130
-> ( Vec < MapEntry < ' hir > > , Svh ) {
130
- let mut node_hashes : Vec < _ > = self
131
+ self
131
132
. hir_body_nodes
132
- . iter ( )
133
- . map ( |& ( def_path_hash, dep_node_index) | {
134
- ( def_path_hash, self . dep_graph . fingerprint_of ( dep_node_index) )
135
- } )
136
- . collect ( ) ;
133
+ . sort_unstable_by ( |& ( ref d1, _) , & ( ref d2, _) | d1. cmp ( d2) ) ;
137
134
138
- node_hashes. sort_unstable_by ( |& ( ref d1, _) , & ( ref d2, _) | d1. cmp ( d2) ) ;
135
+ let node_hashes = self
136
+ . hir_body_nodes
137
+ . iter ( )
138
+ . fold ( Fingerprint :: ZERO , |fingerprint , & ( def_path_hash, dep_node_index) | {
139
+ fingerprint. combine (
140
+ def_path_hash. 0 . combine ( self . dep_graph . fingerprint_of ( dep_node_index) )
141
+ )
142
+ } ) ;
139
143
140
144
let mut upstream_crates: Vec < _ > = cstore. crates_untracked ( ) . iter ( ) . map ( |& cnum| {
141
145
let name = cstore. crate_name_untracked ( cnum) . as_str ( ) ;
0 commit comments