Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,14 @@ fn run_compiler(
}

// Make sure name resolution and macro expansion is run.
queries.global_ctxt()?.enter(|tcx| tcx.resolver_for_lowering());
let mut gcx = queries.global_ctxt()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was attempted before and reverted - #107740.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, we should add a comment to point this out linking to #107740 and why.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW #132410 changes after_analysis to pass in TyCtxt directly, avoiding the double locking issue.

gcx.enter(|tcx| tcx.resolver_for_lowering());

if callbacks.after_expansion(compiler, queries) == Compilation::Stop {
return early_exit();
}

queries.global_ctxt()?.enter(|tcx| {
gcx.enter(|tcx| {
passes::write_dep_info(tcx);
});

Expand All @@ -444,13 +445,13 @@ fn run_compiler(
return early_exit();
}

queries.global_ctxt()?.enter(|tcx| tcx.analysis(()))?;
gcx.enter(|tcx| tcx.analysis(()))?;

if callbacks.after_analysis(compiler, queries) == Compilation::Stop {
return early_exit();
}

queries.global_ctxt()?.enter(|tcx| {
gcx.enter(|tcx| {
Ok(Some(Linker::codegen_and_build_linker(tcx, &*compiler.codegen_backend)?))
})
})?;
Expand Down