about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-02-16 11:36:44 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-02-20 15:28:59 +0000
commit63c8d000904fcb09cae22fba1768b955e354ebb8 (patch)
tree1127480ddd0dde6d73188c861e0a240a7d36377a /compiler/rustc_interface/src
parent1202fce40ea91ac26cbfefe2532aa5c5c3755991 (diff)
downloadrust-63c8d000904fcb09cae22fba1768b955e354ebb8.tar.gz
rust-63c8d000904fcb09cae22fba1768b955e354ebb8.zip
Use tcx queries instead of passing the values to `configure_and_expand`.
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs11
-rw-r--r--compiler/rustc_interface/src/queries.rs10
2 files changed, 8 insertions, 13 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 43882e10303..85f39e2aaac 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -12,7 +12,7 @@ use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal};
 use rustc_errors::{ErrorGuaranteed, PResult};
 use rustc_expand::base::{ExtCtxt, LintStoreExpand, ResolverExpand};
 use rustc_hir::def_id::{StableCrateId, LOCAL_CRATE};
-use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore};
+use rustc_lint::{unerased_lint_store, BufferedEarlyLint, EarlyCheckNode, LintStore};
 use rustc_metadata::creader::CStore;
 use rustc_middle::arena::Arena;
 use rustc_middle::dep_graph::DepGraph;
@@ -171,14 +171,15 @@ impl LintStoreExpand for LintStoreExpandImpl<'_> {
 /// syntax expansion, secondary `cfg` expansion, synthesis of a test
 /// harness if one is to be provided, injection of a dependency on the
 /// standard library and prelude, and name resolution.
+#[instrument(level = "trace", skip(tcx, krate, resolver))]
 pub fn configure_and_expand(
-    sess: &Session,
-    lint_store: &LintStore,
+    tcx: TyCtxt<'_>,
     mut krate: ast::Crate,
-    crate_name: Symbol,
     resolver: &mut Resolver<'_, '_>,
 ) -> Result<ast::Crate> {
-    trace!("configure_and_expand");
+    let sess = tcx.sess;
+    let lint_store = unerased_lint_store(tcx);
+    let crate_name = tcx.crate_name(LOCAL_CRATE);
     pre_expansion_lint(sess, lint_store, resolver.registered_tools(), &krate, crate_name);
     rustc_builtin_macros::register_builtin_macros(resolver);
 
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs
index 7689e3cec06..e2c05350e09 100644
--- a/compiler/rustc_interface/src/queries.rs
+++ b/compiler/rustc_interface/src/queries.rs
@@ -204,7 +204,7 @@ impl<'tcx> Queries<'tcx> {
 
             let qcx = passes::create_global_ctxt(
                 self.compiler,
-                lint_store.clone(),
+                lint_store,
                 self.dep_graph()?.steal(),
                 untracked,
                 &self.queries,
@@ -227,13 +227,7 @@ impl<'tcx> Queries<'tcx> {
                         self.codegen_backend().metadata_loader(),
                         &arenas,
                     );
-                    let krate = passes::configure_and_expand(
-                        sess,
-                        &lint_store,
-                        krate,
-                        crate_name,
-                        &mut resolver,
-                    )?;
+                    let krate = passes::configure_and_expand(tcx, krate, &mut resolver)?;
 
                     // Make sure we don't mutate the cstore from here on.
                     tcx.untracked().cstore.leak();