1
Fork 0

Get rid of feed_local_def_id

This commit is contained in:
Oli Scherer 2024-02-14 15:44:01 +00:00
parent 30f2ec2895
commit 5a0c46a22c
3 changed files with 7 additions and 6 deletions

View file

@ -173,7 +173,7 @@ impl<'tcx> Queries<'tcx> {
feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
feed.output_filenames(Arc::new(outputs));
let feed = tcx.feed_local_def_id(CRATE_DEF_ID);
let feed = tcx.feed_local_crate_def_id();
feed.def_kind(DefKind::Mod);
});
Ok(qcx)

View file

@ -60,7 +60,7 @@ use rustc_session::config::CrateType;
use rustc_session::cstore::{CrateStoreDyn, Untracked};
use rustc_session::lint::Lint;
use rustc_session::{Limit, MetadataKind, Session};
use rustc_span::def_id::{DefPathHash, StableCrateId};
use rustc_span::def_id::{DefPathHash, StableCrateId, CRATE_DEF_ID};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{Span, DUMMY_SP};
use rustc_target::abi::{FieldIdx, Layout, LayoutS, TargetDataLayout, VariantIdx};
@ -544,8 +544,9 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn feed_local_crate(self) -> TyCtxtFeed<'tcx, CrateNum> {
TyCtxtFeed { tcx: self, key: LOCAL_CRATE }
}
pub fn feed_local_def_id(self, key: LocalDefId) -> TyCtxtFeed<'tcx, LocalDefId> {
TyCtxtFeed { tcx: self, key }
pub fn feed_local_crate_def_id(self) -> TyCtxtFeed<'tcx, LocalDefId> {
TyCtxtFeed { tcx: self, key: CRATE_DEF_ID }
}
/// In order to break cycles involving `AnonConst`, we need to set the expected type by side
@ -1123,7 +1124,7 @@ impl<'tcx> TyCtxt<'tcx> {
// needs to be re-evaluated.
self.dep_graph.read_index(DepNodeIndex::FOREVER_RED_NODE);
let feed = self.feed_local_def_id(def_id);
let feed = TyCtxtFeed { tcx: self, key: def_id };
feed.def_kind(def_kind);
// Unique types created for closures participate in type privacy checking.
// They have visibilities inherited from the module they are defined in.

View file

@ -1340,7 +1340,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let mut def_id_to_node_id = IndexVec::default();
assert_eq!(def_id_to_node_id.push(CRATE_NODE_ID), CRATE_DEF_ID);
let mut node_id_to_def_id = NodeMap::default();
let crate_feed = tcx.feed_local_def_id(CRATE_DEF_ID).downgrade();
let crate_feed = tcx.feed_local_crate_def_id().downgrade();
node_id_to_def_id.insert(CRATE_NODE_ID, crate_feed);
let mut invocation_parents = FxHashMap::default();