diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-11-26 20:43:34 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-11-09 17:55:40 +0000 |
| commit | 1eece7478d23b4530a5ecb604e4ea1aad3e4d62f (patch) | |
| tree | 495f4717b435242f5fd3a3fbe5281ce8aec1c25c /compiler/rustc_driver_impl/src | |
| parent | 8e9bbc899c7a1913ff04d9af516efee900aeffd1 (diff) | |
| download | rust-1eece7478d23b4530a5ecb604e4ea1aad3e4d62f.tar.gz rust-1eece7478d23b4530a5ecb604e4ea1aad3e4d62f.zip | |
Reduce the amount of GlobalCtxt::enter calls in the driver
We now only exit the GlobalCtxt when calling a callback and all the way at the end when the GlobalCtxt is about to be destroyed.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 407c7d9c5a9..7d0c8644dbf 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -396,10 +396,6 @@ fn run_compiler( queries.global_ctxt()?.enter(|tcx| { tcx.ensure().early_lint_checks(()); pretty::print(sess, pp_mode, pretty::PrintExtra::NeedsAstMap { tcx }); - Ok(()) - })?; - - queries.global_ctxt()?.enter(|tcx| { passes::write_dep_info(tcx); }); } else { @@ -429,19 +425,19 @@ fn run_compiler( queries.global_ctxt()?.enter(|tcx| { passes::write_dep_info(tcx); - }); - if sess.opts.output_types.contains_key(&OutputType::DepInfo) - && sess.opts.output_types.len() == 1 - { - return early_exit(); - } + if sess.opts.output_types.contains_key(&OutputType::DepInfo) + && sess.opts.output_types.len() == 1 + { + return early_exit(); + } - if sess.opts.unstable_opts.no_analysis { - return early_exit(); - } + if sess.opts.unstable_opts.no_analysis { + return early_exit(); + } - queries.global_ctxt()?.enter(|tcx| tcx.analysis(()))?; + tcx.analysis(())?; + })?; if callbacks.after_analysis(compiler, queries) == Compilation::Stop { return early_exit(); |
