1
Fork 0

Move stable_crate_ids from CrateStore to Untracked

This way it's like `Definitions`, which creates `DefId`s by interning `DefPathData`s, but for interning stable crate hashes
This commit is contained in:
Oli Scherer 2024-03-26 16:52:06 +00:00
parent 10be74569c
commit fbc9b94064
5 changed files with 42 additions and 32 deletions

View file

@ -8,7 +8,7 @@ use rustc_codegen_ssa::CodegenResults;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{AppendOnlyIndexVec, FreezeLock, OnceLock, WorkerLocal};
use rustc_hir::def_id::{StableCrateId, LOCAL_CRATE};
use rustc_hir::def_id::{StableCrateId, StableCrateIdMap, LOCAL_CRATE};
use rustc_hir::definitions::Definitions;
use rustc_incremental::setup_dep_graph;
use rustc_metadata::creader::CStore;
@ -140,11 +140,17 @@ impl<'tcx> Queries<'tcx> {
let cstore = FreezeLock::new(Box::new(CStore::new(
self.compiler.codegen_backend.metadata_loader(),
stable_crate_id,
)) as _);
let definitions = FreezeLock::new(Definitions::new(stable_crate_id));
let untracked =
Untracked { cstore, source_span: AppendOnlyIndexVec::new(), definitions };
let mut stable_crate_ids = StableCrateIdMap::default();
stable_crate_ids.insert(stable_crate_id, LOCAL_CRATE);
let untracked = Untracked {
cstore,
source_span: AppendOnlyIndexVec::new(),
definitions,
stable_crate_ids: FreezeLock::new(stable_crate_ids),
};
let qcx = passes::create_global_ctxt(
self.compiler,