Avoid locking the global context across the after_expansion
callback
This commit is contained in:
parent
0c13c17250
commit
0ddf249532
@ -326,14 +326,16 @@ fn run_compiler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut gctxt = queries.global_ctxt()?;
|
// Make sure name resolution and macro expansion is run.
|
||||||
|
queries.global_ctxt()?;
|
||||||
|
|
||||||
if callbacks.after_expansion(compiler, queries) == Compilation::Stop {
|
if callbacks.after_expansion(compiler, queries) == Compilation::Stop {
|
||||||
return early_exit();
|
return early_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the `output_filenames` query is run for its side
|
// Make sure the `output_filenames` query is run for its side
|
||||||
// effects of writing the dep-info and reporting errors.
|
// effects of writing the dep-info and reporting errors.
|
||||||
gctxt.enter(|tcx| tcx.output_filenames(()));
|
queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(()));
|
||||||
|
|
||||||
if sess.opts.output_types.contains_key(&OutputType::DepInfo)
|
if sess.opts.output_types.contains_key(&OutputType::DepInfo)
|
||||||
&& sess.opts.output_types.len() == 1
|
&& sess.opts.output_types.len() == 1
|
||||||
@ -345,7 +347,7 @@ fn run_compiler(
|
|||||||
return early_exit();
|
return early_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
gctxt.enter(|tcx| {
|
queries.global_ctxt()?.enter(|tcx| {
|
||||||
let result = tcx.analysis(());
|
let result = tcx.analysis(());
|
||||||
if sess.opts.unstable_opts.save_analysis {
|
if sess.opts.unstable_opts.save_analysis {
|
||||||
let crate_name = tcx.crate_name(LOCAL_CRATE);
|
let crate_name = tcx.crate_name(LOCAL_CRATE);
|
||||||
@ -362,8 +364,6 @@ fn run_compiler(
|
|||||||
result
|
result
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
drop(gctxt);
|
|
||||||
|
|
||||||
if callbacks.after_analysis(compiler, queries) == Compilation::Stop {
|
if callbacks.after_analysis(compiler, queries) == Compilation::Stop {
|
||||||
return early_exit();
|
return early_exit();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user