diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2023-08-08 20:08:24 +0800 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2023-08-09 14:35:23 +0800 |
| commit | 907aa440cf51859b97dd0a1e25b6f15d344f4ebe (patch) | |
| tree | 3ae4371e150c7cf91f8428d18613f83fa830d3fa /compiler/rustc_interface/src | |
| parent | 0b89aac08d7190961544ced9e868cc20ce24d786 (diff) | |
| download | rust-907aa440cf51859b97dd0a1e25b6f15d344f4ebe.tar.gz rust-907aa440cf51859b97dd0a1e25b6f15d344f4ebe.zip | |
rustc: Move `stable_crate_id` from `Session` to `GlobalCtxt`
Removes a piece of mutable state. Follow up to #114578.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index c4603cbf1f8..def9fdcd3c7 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::PResult; use rustc_expand::base::{ExtCtxt, LintStoreExpand}; use rustc_fs_util::try_canonicalize; -use rustc_hir::def_id::LOCAL_CRATE; +use rustc_hir::def_id::{StableCrateId, LOCAL_CRATE}; use rustc_lint::{unerased_lint_store, BufferedEarlyLint, EarlyCheckNode, LintStore}; use rustc_metadata::creader::CStore; use rustc_middle::arena::Arena; @@ -666,6 +666,7 @@ pub static DEFAULT_EXTERN_QUERY_PROVIDERS: LazyLock<ExternProviders> = LazyLock: pub fn create_global_ctxt<'tcx>( compiler: &'tcx Compiler, crate_types: Vec<CrateType>, + stable_crate_id: StableCrateId, lint_store: Lrc<LintStore>, dep_graph: DepGraph, untracked: Untracked, @@ -699,6 +700,7 @@ pub fn create_global_ctxt<'tcx>( TyCtxt::create_global_ctxt( sess, crate_types, + stable_crate_id, lint_store, arena, hir_arena, diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 84b49c21db0..7687e83da76 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -234,13 +234,13 @@ impl<'tcx> Queries<'tcx> { debug_assert_eq!(_id, CRATE_DEF_ID); let untracked = Untracked { cstore, source_span, definitions }; - // FIXME: Move these fields from session to tcx and make them immutable. - sess.stable_crate_id.set(stable_crate_id).expect("not yet initialized"); + // FIXME: Move features from session to tcx and make them immutable. sess.init_features(rustc_expand::config::features(sess, &pre_configured_attrs)); let qcx = passes::create_global_ctxt( self.compiler, crate_types, + stable_crate_id, lint_store, self.dep_graph(dep_graph_future), untracked, |
