Skip to content

Commit e9a2f8f

Browse files
committed
Remove feed_local_crate in favor of creating the CrateNum via TyCtxt
1 parent 9e63e99 commit e9a2f8f

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

compiler/rustc_interface/src/queries.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ impl<'tcx> Queries<'tcx> {
143143
)) as _);
144144
let definitions = FreezeLock::new(Definitions::new(stable_crate_id));
145145

146-
let mut stable_crate_ids = StableCrateIdMap::default();
147-
stable_crate_ids.insert(stable_crate_id, LOCAL_CRATE);
146+
let stable_crate_ids = FreezeLock::new(StableCrateIdMap::default());
148147
let untracked = Untracked {
149148
cstore,
150149
source_span: AppendOnlyIndexVec::new(),
151150
definitions,
152-
stable_crate_ids: FreezeLock::new(stable_crate_ids),
151+
stable_crate_ids,
153152
};
154153

155154
let qcx = passes::create_global_ctxt(
@@ -164,7 +163,8 @@ impl<'tcx> Queries<'tcx> {
164163
);
165164

166165
qcx.enter(|tcx| {
167-
let feed = tcx.feed_local_crate();
166+
let feed = tcx.create_crate_num(stable_crate_id).unwrap();
167+
assert_eq!(feed.key(), LOCAL_CRATE);
168168
feed.crate_name(crate_name);
169169

170170
let feed = tcx.feed_unit_query();

compiler/rustc_middle/src/ty/context.rs

-7
Original file line numberDiff line numberDiff line change
@@ -565,13 +565,6 @@ impl<'tcx> TyCtxt<'tcx> {
565565
TyCtxtFeed { tcx: self, key: () }
566566
}
567567

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

0 commit comments

Comments
 (0)