Remove feed_local_crate in favor of creating the CrateNum via TyCtxt

This commit is contained in:
Oli Scherer 2024-03-27 08:07:23 +00:00
parent 9e63e991e9
commit e9a2f8fef1
2 changed files with 4 additions and 11 deletions

View File

@ -143,13 +143,12 @@ impl<'tcx> Queries<'tcx> {
)) as _); )) as _);
let definitions = FreezeLock::new(Definitions::new(stable_crate_id)); let definitions = FreezeLock::new(Definitions::new(stable_crate_id));
let mut stable_crate_ids = StableCrateIdMap::default(); let stable_crate_ids = FreezeLock::new(StableCrateIdMap::default());
stable_crate_ids.insert(stable_crate_id, LOCAL_CRATE);
let untracked = Untracked { let untracked = Untracked {
cstore, cstore,
source_span: AppendOnlyIndexVec::new(), source_span: AppendOnlyIndexVec::new(),
definitions, definitions,
stable_crate_ids: FreezeLock::new(stable_crate_ids), stable_crate_ids,
}; };
let qcx = passes::create_global_ctxt( let qcx = passes::create_global_ctxt(
@ -164,7 +163,8 @@ impl<'tcx> Queries<'tcx> {
); );
qcx.enter(|tcx| { qcx.enter(|tcx| {
let feed = tcx.feed_local_crate(); let feed = tcx.create_crate_num(stable_crate_id).unwrap();
assert_eq!(feed.key(), LOCAL_CRATE);
feed.crate_name(crate_name); feed.crate_name(crate_name);
let feed = tcx.feed_unit_query(); let feed = tcx.feed_unit_query();

View File

@ -565,13 +565,6 @@ impl<'tcx> TyCtxt<'tcx> {
TyCtxtFeed { tcx: self, key: () } TyCtxtFeed { tcx: self, key: () }
} }
/// Can only be fed before queries are run, and is thus exempt from any
/// incremental issues. Do not use except for the initial query feeding.
pub fn feed_local_crate(self) -> TyCtxtFeed<'tcx, CrateNum> {
self.dep_graph.assert_ignored();
TyCtxtFeed { tcx: self, key: LOCAL_CRATE }
}
/// Only used in the resolver to register the `CRATE_DEF_ID` `DefId` and feed /// Only used in the resolver to register the `CRATE_DEF_ID` `DefId` and feed
/// some queries for it. It will panic if used twice. /// some queries for it. It will panic if used twice.
pub fn create_local_crate_def_id(self, span: Span) -> TyCtxtFeed<'tcx, LocalDefId> { pub fn create_local_crate_def_id(self, span: Span) -> TyCtxtFeed<'tcx, LocalDefId> {