Skip to content

Commit 93f7b24

Browse files
committed
Run item-types checking and item-bodies checking in parallel
1 parent 011e972 commit 93f7b24

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/librustc_typeck/lib.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ use rustc::ty::subst::SubstsRef;
102102
use rustc::ty::{self, Ty, TyCtxt};
103103
use rustc::util;
104104
use rustc::util::common::ErrorReported;
105-
use rustc_data_structures::sync::par_for_each;
105+
use rustc_data_structures::sync::{join, par_for_each};
106106
use rustc_errors::struct_span_err;
107107
use rustc_hir as hir;
108108
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
@@ -343,14 +343,19 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
343343
tcx.sess.time("wf_checking", || check::check_wf_new(tcx));
344344
})?;
345345

346-
tcx.sess.time("item_types_checking", || {
347-
par_for_each(&tcx.hir().krate().modules, |(&module, _)| {
348-
tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));
349-
});
346+
tcx.sess.time("item_types_and_item_bodies_checking", || {
347+
join(
348+
|| {
349+
tcx.sess.time("item_types_checking", || {
350+
par_for_each(&tcx.hir().krate().modules, |(&module, _)| {
351+
tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module));
352+
});
353+
})
354+
},
355+
|| tcx.sess.time("item_bodies_checking", || tcx.typeck_item_bodies(LOCAL_CRATE)),
356+
)
350357
});
351358

352-
tcx.sess.time("item_bodies_checking", || tcx.typeck_item_bodies(LOCAL_CRATE));
353-
354359
check_unused::check_crate(tcx);
355360
check_for_entry_fn(tcx);
356361

0 commit comments

Comments
 (0)