about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-10-31 14:43:23 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-12-14 14:24:35 +0000
commit6ece8036329ac01eca7724c3b4b691b258d04e16 (patch)
tree999f31984013365fba76f1f7c73f9f995e780d92 /compiler/rustc_driver_impl/src
parented141926048597e3649bb238ca3dc417904cd56c (diff)
downloadrust-6ece8036329ac01eca7724c3b4b691b258d04e16.tar.gz
rust-6ece8036329ac01eca7724c3b4b691b258d04e16.zip
Get rid of of the global_ctxt query
Diffstat (limited to 'compiler/rustc_driver_impl/src')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index b80736f41ad..397e477d471 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -45,7 +45,7 @@ use rustc_errors::registry::Registry;
 use rustc_errors::{ColorConfig, DiagCtxt, ErrCode, FatalError, PResult, markdown};
 use rustc_feature::find_gated_cfg;
 use rustc_interface::util::{self, get_codegen_backend};
-use rustc_interface::{Linker, interface, passes};
+use rustc_interface::{Linker, create_and_enter_global_ctxt, interface, passes};
 use rustc_lint::unerased_lint_store;
 use rustc_metadata::creader::MetadataLoader;
 use rustc_metadata::locator;
@@ -400,7 +400,9 @@ fn run_compiler(
             // If pretty printing is requested: Figure out the representation, print it and exit
             if let Some(pp_mode) = sess.opts.pretty {
                 if pp_mode.needs_ast_map() {
-                    queries.global_ctxt().enter(|tcx| {
+                    let krate = queries.parse().steal();
+
+                    create_and_enter_global_ctxt(&compiler, krate, |tcx| {
                         tcx.ensure().early_lint_checks(());
                         pretty::print(sess, pp_mode, pretty::PrintExtra::NeedsAstMap { tcx });
                         passes::write_dep_info(tcx);
@@ -425,7 +427,9 @@ fn run_compiler(
                 return early_exit();
             }
 
-            queries.global_ctxt().enter(|tcx| {
+            let krate = queries.parse().steal();
+
+            create_and_enter_global_ctxt(&compiler, krate, |tcx| {
                 // Make sure name resolution and macro expansion is run.
                 let _ = tcx.resolver_for_lowering();