Drop AST on a separate thread and prefetch hir_crate

This commit is contained in:
John Kåre Alsaker
2024-03-02 18:32:42 +01:00
parent efcbb94dcc
commit ef9403371f
4 changed files with 26 additions and 3 deletions

View File

@@ -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!(