Skip to content

Commit 4bb2cbb

Browse files
committed
close parallel for lints
1 parent 1e137bd commit 4bb2cbb

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

compiler/rustc_lint/src/late.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -436,24 +436,32 @@ pub fn check_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(
436436
tcx: TyCtxt<'tcx>,
437437
builtin_lints: impl FnOnce() -> T + Send + DynSend,
438438
) {
439-
join(
440-
|| {
441-
tcx.sess.time("crate_lints", || {
442-
// Run whole crate non-incremental lints
443-
late_lint_crate(tcx, builtin_lints());
444-
});
445-
},
446-
|| {
447-
tcx.sess.time("module_lints", || {
448-
let has_cache = tcx.query_system.on_disk_cache.as_ref().map(|cache| cache.has_cache()).unwrap_or(false);
449-
450-
// Run per-module lints
451-
if has_cache {
452-
tcx.hir().for_each_module(|module| tcx.ensure().lint_mod(module));
453-
} else {
439+
let has_cache =
440+
tcx.query_system.on_disk_cache.as_ref().map(|cache| cache.has_cache()).unwrap_or(false);
441+
442+
if has_cache {
443+
tcx.sess.time("crate_lints", || {
444+
// Run whole crate non-incremental lints
445+
late_lint_crate(tcx, builtin_lints());
446+
});
447+
448+
tcx.sess.time("module_lints", || {
449+
// Run per-module lints
450+
tcx.hir().for_each_module(|module| tcx.ensure().lint_mod(module));
451+
});
452+
} else {
453+
join(
454+
|| {
455+
tcx.sess.time("crate_lints", || {
456+
// Run whole crate non-incremental lints
457+
late_lint_crate(tcx, builtin_lints());
458+
});
459+
},
460+
|| {
461+
tcx.sess.time("module_lints", || {
454462
tcx.hir().par_for_each_module(|module| tcx.ensure().lint_mod(module));
455-
}
456-
});
457-
},
458-
);
463+
});
464+
},
465+
);
466+
}
459467
}

0 commit comments

Comments
 (0)