Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove TyCtxt::hir_krate.
It's a trivial wrapper around the `hir_crate` query with a small number
of uses.
  • Loading branch information
nnethercote committed Feb 17, 2025
commit f666361caa963c3f41934d5b431af24d8894d159
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_middle/src/hir/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down