@@ -189,7 +189,7 @@ use rustc::ty::print::obsolete::DefPathBasedNames;
189
189
use rustc:: ty:: subst:: { InternalSubsts , SubstsRef } ;
190
190
use rustc:: ty:: { self , GenericParamDefKind , Instance , Ty , TyCtxt , TypeFoldable } ;
191
191
use 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 } ;
193
193
use rustc_hir as hir;
194
194
use rustc_hir:: def_id:: { DefId , DefIdMap , LOCAL_CRATE } ;
195
195
use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
@@ -278,8 +278,16 @@ pub fn collect_crate_mono_items(
278
278
) -> ( FxHashSet < MonoItem < ' _ > > , InliningMap < ' _ > ) {
279
279
let _prof_timer = tcx. prof . generic_activity ( "monomorphization_collector" ) ;
280
280
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
+ ) ;
283
291
284
292
debug ! ( "building mono item graph, beginning at roots" ) ;
285
293
0 commit comments