Skip to content

rustc_driver cleanup #83610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 12, 2021
Merged
18 changes: 7 additions & 11 deletions compiler/rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,10 @@ fn run_compiler(
return early_exit();
}

if sess.opts.debugging_opts.save_analysis {
let crate_name = queries.crate_name()?.peek().clone();
queries.global_ctxt()?.peek_mut().enter(|tcx| {
let result = tcx.analysis(LOCAL_CRATE);

let crate_name = queries.crate_name()?.peek().clone();
queries.global_ctxt()?.peek_mut().enter(|tcx| {
let result = tcx.analysis(LOCAL_CRATE);
if sess.opts.debugging_opts.save_analysis {
sess.time("save_analysis", || {
save::process_crate(
tcx,
Expand All @@ -428,12 +427,9 @@ fn run_compiler(
),
)
});

result
})?;
}

queries.global_ctxt()?.peek_mut().enter(|tcx| tcx.analysis(LOCAL_CRATE))?;
}
result
})?;

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