@@ -189,7 +189,7 @@ use rustc::ty::print::obsolete::DefPathBasedNames;
189189use rustc:: ty:: subst:: { InternalSubsts , SubstsRef } ;
190190use rustc:: ty:: { self , GenericParamDefKind , Instance , Ty , TyCtxt , TypeFoldable } ;
191191use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
192- use rustc_data_structures:: sync:: { par_for_each, MTLock , MTRef } ;
192+ use rustc_data_structures:: sync:: { join , par_for_each, MTLock , MTRef } ;
193193use rustc_hir as hir;
194194use rustc_hir:: def_id:: { DefId , DefIdMap , LOCAL_CRATE } ;
195195use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
@@ -278,8 +278,16 @@ pub fn collect_crate_mono_items(
278278) -> ( FxHashSet < MonoItem < ' _ > > , InliningMap < ' _ > ) {
279279 let _prof_timer = tcx. prof . generic_activity ( "monomorphization_collector" ) ;
280280
281- let roots =
282- tcx. sess . time ( "monomorphization_collector_root_collections" , || collect_roots ( tcx, mode) ) ;
281+ let ( roots, _) = join (
282+ || {
283+ tcx. sess
284+ . time ( "monomorphization_collector_root_collections" , || collect_roots ( tcx, mode) )
285+ } ,
286+ || {
287+ // Prefetch upstream_monomorphizations
288+ tcx. upstream_monomorphizations ( LOCAL_CRATE ) ;
289+ } ,
290+ ) ;
283291
284292 debug ! ( "building mono item graph, beginning at roots" ) ;
285293
0 commit comments