@@ -6,7 +6,6 @@ use rustc_ast as ast;
66use rustc_data_structures:: fingerprint:: Fingerprint ;
77use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
88use rustc_data_structures:: svh:: Svh ;
9- use rustc_data_structures:: sync:: { self , par_iter} ;
109use rustc_hir:: def:: { DefKind , Res } ;
1110use rustc_hir:: def_id:: { CrateNum , DefId , LocalDefId , CRATE_DEF_ID , CRATE_DEF_INDEX , LOCAL_CRATE } ;
1211use rustc_hir:: definitions:: { DefKey , DefPath , DefPathHash } ;
@@ -571,13 +570,20 @@ impl<'hir> Map<'hir> {
571570 }
572571 }
573572
574- pub fn par_for_each_module ( & self , f : impl Fn ( LocalDefId ) + sync:: Sync ) {
575- use rustc_data_structures:: sync:: ParallelIterator ;
573+ #[ cfg( not( parallel_compiler) ) ]
574+ #[ inline]
575+ pub fn par_for_each_module ( & self , f : impl Fn ( LocalDefId ) ) {
576+ self . for_each_module ( f)
577+ }
578+
579+ #[ cfg( parallel_compiler) ]
580+ pub fn par_for_each_module ( & self , f : impl Fn ( LocalDefId ) + Sync ) {
581+ use rustc_data_structures:: sync:: { par_iter, ParallelIterator } ;
576582 par_iter_submodules ( self . tcx , CRATE_DEF_ID , & f) ;
577583
578584 fn par_iter_submodules < F > ( tcx : TyCtxt < ' _ > , module : LocalDefId , f : & F )
579585 where
580- F : Fn ( LocalDefId ) + sync :: Sync ,
586+ F : Fn ( LocalDefId ) + Sync ,
581587 {
582588 ( * f) ( module) ;
583589 let items = tcx. hir_module_items ( module) ;
0 commit comments