Skip to content

Commit 63c8d00

Browse files
committed
Use tcx queries instead of passing the values to configure_and_expand.
1 parent 1202fce commit 63c8d00

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

compiler/rustc_interface/src/passes.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal};
1212
use rustc_errors::{ErrorGuaranteed, PResult};
1313
use rustc_expand::base::{ExtCtxt, LintStoreExpand, ResolverExpand};
1414
use rustc_hir::def_id::{StableCrateId, LOCAL_CRATE};
15-
use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore};
15+
use rustc_lint::{unerased_lint_store, BufferedEarlyLint, EarlyCheckNode, LintStore};
1616
use rustc_metadata::creader::CStore;
1717
use rustc_middle::arena::Arena;
1818
use rustc_middle::dep_graph::DepGraph;
@@ -171,14 +171,15 @@ impl LintStoreExpand for LintStoreExpandImpl<'_> {
171171
/// syntax expansion, secondary `cfg` expansion, synthesis of a test
172172
/// harness if one is to be provided, injection of a dependency on the
173173
/// standard library and prelude, and name resolution.
174+
#[instrument(level = "trace", skip(tcx, krate, resolver))]
174175
pub fn configure_and_expand(
175-
sess: &Session,
176-
lint_store: &LintStore,
176+
tcx: TyCtxt<'_>,
177177
mut krate: ast::Crate,
178-
crate_name: Symbol,
179178
resolver: &mut Resolver<'_, '_>,
180179
) -> Result<ast::Crate> {
181-
trace!("configure_and_expand");
180+
let sess = tcx.sess;
181+
let lint_store = unerased_lint_store(tcx);
182+
let crate_name = tcx.crate_name(LOCAL_CRATE);
182183
pre_expansion_lint(sess, lint_store, resolver.registered_tools(), &krate, crate_name);
183184
rustc_builtin_macros::register_builtin_macros(resolver);
184185

compiler/rustc_interface/src/queries.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl<'tcx> Queries<'tcx> {
204204

205205
let qcx = passes::create_global_ctxt(
206206
self.compiler,
207-
lint_store.clone(),
207+
lint_store,
208208
self.dep_graph()?.steal(),
209209
untracked,
210210
&self.queries,
@@ -227,13 +227,7 @@ impl<'tcx> Queries<'tcx> {
227227
self.codegen_backend().metadata_loader(),
228228
&arenas,
229229
);
230-
let krate = passes::configure_and_expand(
231-
sess,
232-
&lint_store,
233-
krate,
234-
crate_name,
235-
&mut resolver,
236-
)?;
230+
let krate = passes::configure_and_expand(tcx, krate, &mut resolver)?;
237231

238232
// Make sure we don't mutate the cstore from here on.
239233
tcx.untracked().cstore.leak();

0 commit comments

Comments
 (0)