Skip to content

Commit 4ae6054

Browse files
committed
Get rid of feed_local_def_id
1 parent f028733 commit 4ae6054

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

compiler/rustc_interface/src/queries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<'tcx> Queries<'tcx> {
173173
feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
174174
feed.output_filenames(Arc::new(outputs));
175175

176-
let feed = tcx.feed_local_def_id(CRATE_DEF_ID);
176+
let feed = tcx.feed_local_crate_def_id();
177177
feed.def_kind(DefKind::Mod);
178178
});
179179
Ok(qcx)

compiler/rustc_middle/src/ty/context.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use rustc_session::config::CrateType;
6262
use rustc_session::cstore::{CrateStoreDyn, Untracked};
6363
use rustc_session::lint::Lint;
6464
use rustc_session::{Limit, MetadataKind, Session};
65-
use rustc_span::def_id::{DefPathHash, StableCrateId};
65+
use rustc_span::def_id::{DefPathHash, StableCrateId, CRATE_DEF_ID};
6666
use rustc_span::symbol::{kw, sym, Ident, Symbol};
6767
use rustc_span::{Span, DUMMY_SP};
6868
use rustc_target::abi::{FieldIdx, Layout, LayoutS, TargetDataLayout, VariantIdx};
@@ -540,8 +540,9 @@ impl<'tcx> TyCtxt<'tcx> {
540540
pub fn feed_local_crate(self) -> TyCtxtFeed<'tcx, CrateNum> {
541541
TyCtxtFeed { tcx: self, key: LOCAL_CRATE }
542542
}
543-
pub fn feed_local_def_id(self, key: LocalDefId) -> TyCtxtFeed<'tcx, LocalDefId> {
544-
TyCtxtFeed { tcx: self, key }
543+
544+
pub fn feed_local_crate_def_id(self) -> TyCtxtFeed<'tcx, LocalDefId> {
545+
TyCtxtFeed { tcx: self, key: CRATE_DEF_ID }
545546
}
546547

547548
/// In order to break cycles involving `AnonConst`, we need to set the expected type by side
@@ -1119,7 +1120,7 @@ impl<'tcx> TyCtxt<'tcx> {
11191120
// needs to be re-evaluated.
11201121
self.dep_graph.read_index(DepNodeIndex::FOREVER_RED_NODE);
11211122

1122-
let feed = self.feed_local_def_id(def_id);
1123+
let feed = TyCtxtFeed { tcx: self, key: def_id };
11231124
feed.def_kind(def_kind);
11241125
// Unique types created for closures participate in type privacy checking.
11251126
// They have visibilities inherited from the module they are defined in.

compiler/rustc_resolve/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
13231323
let mut def_id_to_node_id = IndexVec::default();
13241324
assert_eq!(def_id_to_node_id.push(CRATE_NODE_ID), CRATE_DEF_ID);
13251325
let mut node_id_to_def_id = NodeMap::default();
1326-
let crate_feed = tcx.feed_local_def_id(CRATE_DEF_ID).downgrade();
1326+
let crate_feed = tcx.feed_local_crate_def_id().downgrade();
13271327
node_id_to_def_id.insert(CRATE_NODE_ID, crate_feed);
13281328

13291329
let mut invocation_parents = FxHashMap::default();

0 commit comments

Comments
 (0)