diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-14 15:44:01 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-05 05:52:00 +0000 |
| commit | 5a0c46a22c8264203bb37c5cb27d25810a412283 (patch) | |
| tree | 51f43b9bc1136b768db62d359e54975469931983 /compiler | |
| parent | 30f2ec2895430d87d6e3a34ea290a9d344472452 (diff) | |
| download | rust-5a0c46a22c8264203bb37c5cb27d25810a412283.tar.gz rust-5a0c46a22c8264203bb37c5cb27d25810a412283.zip | |
Get rid of `feed_local_def_id`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 86858bfe41d..f58a2380d2a 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -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) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 760392e8337..f6bd5fc6788 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -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. diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index b8ea110d1c0..25f17e67f46 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -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(); |
