diff options
| author | bors <bors@rust-lang.org> | 2024-04-23 20:46:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-23 20:46:48 +0000 |
| commit | 244da22fabd9fa677bbd0ac601a88e5ca6917526 (patch) | |
| tree | 4027ccd0b3e983d7902e1000cb46f417df37bcea /compiler/rustc_session/src | |
| parent | 40dcd796d094b911b8b7b55a0519fb8e3d21680f (diff) | |
| parent | e9a2f8fef181a8aa0145a2665804916effb6365e (diff) | |
| download | rust-244da22fabd9fa677bbd0ac601a88e5ca6917526.tar.gz rust-244da22fabd9fa677bbd0ac601a88e5ca6917526.zip | |
Auto merge of #123126 - oli-obk:feed_crate_num, r=davidtwco
Enable `CrateNum` query feeding via `TyCtxt` Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s. Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions. These things should be attempted on their own separately, but this PR should stand on its own
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/cstore.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/cstore.rs b/compiler/rustc_session/src/cstore.rs index cb6656bae06..83377b66095 100644 --- a/compiler/rustc_session/src/cstore.rs +++ b/compiler/rustc_session/src/cstore.rs @@ -6,7 +6,9 @@ use crate::search_paths::PathKind; use crate::utils::NativeLibKind; use rustc_ast as ast; use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock}; -use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, StableCrateId, LOCAL_CRATE}; +use rustc_hir::def_id::{ + CrateNum, DefId, LocalDefId, StableCrateId, StableCrateIdMap, LOCAL_CRATE, +}; use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions}; use rustc_span::symbol::Symbol; use rustc_span::Span; @@ -217,7 +219,6 @@ pub trait CrateStore: std::fmt::Debug { // incr. comp. uses to identify a CrateNum. fn crate_name(&self, cnum: CrateNum) -> Symbol; fn stable_crate_id(&self, cnum: CrateNum) -> StableCrateId; - fn stable_crate_id_to_crate_num(&self, stable_crate_id: StableCrateId) -> CrateNum; } pub type CrateStoreDyn = dyn CrateStore + sync::DynSync + sync::DynSend; @@ -227,4 +228,6 @@ pub struct Untracked { /// Reference span for definitions. pub source_span: AppendOnlyIndexVec<LocalDefId, Span>, pub definitions: FreezeLock<Definitions>, + /// The interned [StableCrateId]s. + pub stable_crate_ids: FreezeLock<StableCrateIdMap>, } |
