Skip to content

Commit

Permalink
Get rid of feed_local_def_id
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Feb 14, 2024
1 parent 0d20ef2 commit d6284b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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};
Expand Down Expand Up @@ -540,8 +540,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
Expand Down Expand Up @@ -1119,7 +1120,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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,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();
Expand Down

0 comments on commit d6284b0

Please sign in to comment.