@@ -12,6 +12,7 @@ use super::*;
1212
1313use dep_graph:: { DepGraph , DepKind , DepNodeIndex } ;
1414use hir:: intravisit:: { Visitor , NestedVisitorMap } ;
15+ use middle:: cstore:: CrateStore ;
1516use session:: CrateDisambiguator ;
1617use std:: iter:: repeat;
1718use syntax:: ast:: { NodeId , CRATE_NODE_ID } ;
@@ -119,7 +120,9 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
119120 }
120121
121122 pub ( super ) fn finalize_and_compute_crate_hash ( self ,
122- crate_disambiguator : CrateDisambiguator )
123+ crate_disambiguator : CrateDisambiguator ,
124+ cstore : & CrateStore ,
125+ commandline_args_hash : u64 )
123126 -> Vec < MapEntry < ' hir > > {
124127 let mut node_hashes: Vec < _ > = self
125128 . hir_body_nodes
@@ -132,9 +135,23 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
132135
133136 node_hashes. sort_unstable_by ( |& ( ref d1, _) , & ( ref d2, _) | d1. cmp ( d2) ) ;
134137
138+ let mut upstream_crates: Vec < _ > = cstore. crates_untracked ( ) . iter ( ) . map ( |& cnum| {
139+ let name = cstore. crate_name_untracked ( cnum) . as_str ( ) ;
140+ let disambiguator = cstore. crate_disambiguator_untracked ( cnum)
141+ . to_fingerprint ( ) ;
142+ let hash = cstore. crate_hash_untracked ( cnum) ;
143+ ( name, disambiguator, hash)
144+ } ) . collect ( ) ;
145+
146+ upstream_crates. sort_unstable_by ( |& ( name1, dis1, _) , & ( name2, dis2, _) | {
147+ ( name1, dis1) . cmp ( & ( name2, dis2) )
148+ } ) ;
149+
135150 self . dep_graph . with_task ( DepNode :: new_no_params ( DepKind :: Krate ) ,
136151 & self . hcx ,
137- ( node_hashes, crate_disambiguator. to_fingerprint ( ) ) ,
152+ ( ( node_hashes, upstream_crates) ,
153+ ( commandline_args_hash,
154+ crate_disambiguator. to_fingerprint ( ) ) ) ,
138155 identity_fn) ;
139156 self . map
140157 }
0 commit comments