From ef9403371f2d4759cd7b0d0a276e63aae2ce68fe Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Sat, 2 Mar 2024 18:32:42 +0100 Subject: Drop AST on a separate thread and prefetch `hir_crate` --- compiler/rustc_interface/src/passes.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/rustc_interface') diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 66d2a79b93a..aad63f4edcf 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -900,6 +900,12 @@ fn run_required_analyses(tcx: TyCtxt<'_>) { // is not defined. So we need to cfg it out. #[cfg(all(not(doc), debug_assertions))] rustc_passes::hir_id_validator::check_crate(tcx); + + // Prefetch this to prevent multiple threads from blocking on it later. + // This is needed since the `hir_id_validator::check_crate` call above is not guaranteed + // to use `hir_crate`. + tcx.ensure_done().hir_crate(()); + let sess = tcx.sess; sess.time("misc_checking_1", || { parallel!( -- cgit 1.4.1-3-g733a5