about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-02-17 13:24:07 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2025-02-17 13:24:40 +1100
commitf666361caa963c3f41934d5b431af24d8894d159 (patch)
tree37e2d659a44c42c921206a836d4234e6b52e2c1f
parent661f99ba03738f1ee87888342aef920f3c0f7f48 (diff)
downloadrust-f666361caa963c3f41934d5b431af24d8894d159.tar.gz
rust-f666361caa963c3f41934d5b431af24d8894d159.zip
Remove `TyCtxt::hir_krate`.
It's a trivial wrapper around the `hir_crate` query with a small number
of uses.
-rw-r--r--compiler/rustc_driver_impl/src/pretty.rs2
-rw-r--r--compiler/rustc_middle/src/hir/map.rs8
-rw-r--r--src/librustdoc/core.rs2
3 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs
index ea17dd773c0..093ee659bb4 100644
--- a/compiler/rustc_driver_impl/src/pretty.rs
+++ b/compiler/rustc_driver_impl/src/pretty.rs
@@ -294,7 +294,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
         }
         HirTree => {
             debug!("pretty printing HIR tree");
-            format!("{:#?}", ex.tcx().hir_krate())
+            format!("{:#?}", ex.tcx().hir_crate(()))
         }
         Mir => {
             let mut out = Vec::new();
diff --git a/compiler/rustc_middle/src/hir/map.rs b/compiler/rustc_middle/src/hir/map.rs
index 9bd35fdd6f0..b44f14315d7 100644
--- a/compiler/rustc_middle/src/hir/map.rs
+++ b/compiler/rustc_middle/src/hir/map.rs
@@ -165,12 +165,6 @@ impl<'tcx> TyCtxt<'tcx> {
         self.hir_node(self.parent_hir_id(hir_id))
     }
 
-    /// Best avoided in favour of more targeted methods. See the comment on the `hir_crate` query.
-    #[inline]
-    pub fn hir_krate(self) -> &'tcx Crate<'tcx> {
-        self.hir_crate(())
-    }
-
     #[inline]
     pub fn hir_root_module(self) -> &'tcx Mod<'tcx> {
         match self.hir_owner_node(CRATE_OWNER_ID) {
@@ -414,7 +408,7 @@ impl<'hir> Map<'hir> {
     where
         V: Visitor<'hir>,
     {
-        let krate = self.tcx.hir_krate();
+        let krate = self.tcx.hir_crate(());
         for info in krate.owners.iter() {
             if let MaybeOwner::Owner(info) = info {
                 for attrs in info.attrs.map.values() {
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 09e71f65c14..1ead87fd69d 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -378,7 +378,7 @@ pub(crate) fn run_global_ctxt(
         ctxt.external_traits.insert(sized_trait_did, sized_trait);
     }
 
-    debug!("crate: {:?}", tcx.hir_krate());
+    debug!("crate: {:?}", tcx.hir_crate(()));
 
     let mut krate = tcx.sess.time("clean_crate", || clean::krate(&mut ctxt));