@@ -11,7 +11,7 @@ use rustc_hir::def_id::{CrateNum, DefIndex, LOCAL_CRATE};
1111use rustc_index:: vec:: IndexVec ;
1212use rustc_session:: { CrateDisambiguator , Session } ;
1313use rustc_span:: source_map:: SourceMap ;
14- use rustc_span:: Span ;
14+ use rustc_span:: { Span , Symbol } ;
1515use std:: iter:: repeat;
1616use syntax:: ast:: NodeId ;
1717
9898 ( sig, full)
9999}
100100
101+ fn upstream_crates ( cstore : & dyn CrateStore ) -> Vec < ( Symbol , Fingerprint , Svh ) > {
102+ let mut upstream_crates: Vec < _ > = cstore
103+ . crates_untracked ( )
104+ . iter ( )
105+ . map ( |& cnum| {
106+ let name = cstore. crate_name_untracked ( cnum) ;
107+ let disambiguator = cstore. crate_disambiguator_untracked ( cnum) . to_fingerprint ( ) ;
108+ let hash = cstore. crate_hash_untracked ( cnum) ;
109+ ( name, disambiguator, hash)
110+ } )
111+ . collect ( ) ;
112+ upstream_crates. sort_unstable_by_key ( |& ( name, dis, _) | ( name. as_str ( ) , dis) ) ;
113+ upstream_crates
114+ }
115+
101116impl < ' a , ' hir > NodeCollector < ' a , ' hir > {
102117 pub ( super ) fn root (
103118 sess : & ' a Session ,
@@ -190,18 +205,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
190205 } ,
191206 ) ;
192207
193- let mut upstream_crates: Vec < _ > = cstore
194- . crates_untracked ( )
195- . iter ( )
196- . map ( |& cnum| {
197- let name = cstore. crate_name_untracked ( cnum) ;
198- let disambiguator = cstore. crate_disambiguator_untracked ( cnum) . to_fingerprint ( ) ;
199- let hash = cstore. crate_hash_untracked ( cnum) ;
200- ( name, disambiguator, hash)
201- } )
202- . collect ( ) ;
203-
204- upstream_crates. sort_unstable_by_key ( |& ( name, dis, _) | ( name. as_str ( ) , dis) ) ;
208+ let upstream_crates = upstream_crates ( cstore) ;
205209
206210 // We hash the final, remapped names of all local source files so we
207211 // don't have to include the path prefix remapping commandline args.
0 commit comments