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 @@ pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'tcx>>
)) as _);
let definitions = FreezeLock::new(Definitions::new(stable_crate_id));
let mut stable_crate_ids = StableCrateIdMap::default();
stable_crate_ids.insert(stable_crate_id, LOCAL_CRATE);
let stable_crate_ids = FreezeLock::new(StableCrateIdMap::default());
let untracked = Untracked {
cstore,
source_span: AppendOnlyIndexVec::new(),
definitions,
stable_crate_ids: FreezeLock::new(stable_crate_ids),
stable_crate_ids,
};
let qcx = passes::create_global_ctxt(
@ -164,7 +163,8 @@ pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'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);
let feed = tcx.feed_unit_query();

View File

@ -565,13 +565,6 @@ pub fn feed_unit_query(self) -> TyCtxtFeed<'tcx, ()> {
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
/// some queries for it. It will panic if used twice.
pub fn create_local_crate_def_id(self, span: Span) -> TyCtxtFeed<'tcx, LocalDefId> {