@@ -13,6 +13,7 @@ use dep_graph::{DepGraph, DepKind, DepNodeIndex};
1313use hir:: def_id:: { LOCAL_CRATE , CrateNum } ;
1414use hir:: intravisit:: { Visitor , NestedVisitorMap } ;
1515use hir:: svh:: Svh ;
16+ use ich:: Fingerprint ;
1617use middle:: cstore:: CrateStore ;
1718use session:: CrateDisambiguator ;
1819use std:: iter:: repeat;
@@ -121,21 +122,24 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
121122 collector
122123 }
123124
124- pub ( super ) fn finalize_and_compute_crate_hash ( self ,
125+ pub ( super ) fn finalize_and_compute_crate_hash ( mut self ,
125126 crate_disambiguator : CrateDisambiguator ,
126127 cstore : & dyn CrateStore ,
127128 codemap : & CodeMap ,
128129 commandline_args_hash : u64 )
129130 -> ( Vec < MapEntry < ' hir > > , Svh ) {
130- let mut node_hashes : Vec < _ > = self
131+ self
131132 . 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) ) ;
137134
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+ } ) ;
139143
140144 let mut upstream_crates: Vec < _ > = cstore. crates_untracked ( ) . iter ( ) . map ( |& cnum| {
141145 let name = cstore. crate_name_untracked ( cnum) . as_str ( ) ;
0 commit comments