Skip to content

Commit f666361

Browse files
committed
Remove TyCtxt::hir_krate.
It's a trivial wrapper around the `hir_crate` query with a small number of uses.
1 parent 661f99b commit f666361

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

compiler/rustc_driver_impl/src/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
294294
}
295295
HirTree => {
296296
debug!("pretty printing HIR tree");
297-
format!("{:#?}", ex.tcx().hir_krate())
297+
format!("{:#?}", ex.tcx().hir_crate(()))
298298
}
299299
Mir => {
300300
let mut out = Vec::new();

compiler/rustc_middle/src/hir/map.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,6 @@ impl<'tcx> TyCtxt<'tcx> {
165165
self.hir_node(self.parent_hir_id(hir_id))
166166
}
167167

168-
/// Best avoided in favour of more targeted methods. See the comment on the `hir_crate` query.
169-
#[inline]
170-
pub fn hir_krate(self) -> &'tcx Crate<'tcx> {
171-
self.hir_crate(())
172-
}
173-
174168
#[inline]
175169
pub fn hir_root_module(self) -> &'tcx Mod<'tcx> {
176170
match self.hir_owner_node(CRATE_OWNER_ID) {
@@ -414,7 +408,7 @@ impl<'hir> Map<'hir> {
414408
where
415409
V: Visitor<'hir>,
416410
{
417-
let krate = self.tcx.hir_krate();
411+
let krate = self.tcx.hir_crate(());
418412
for info in krate.owners.iter() {
419413
if let MaybeOwner::Owner(info) = info {
420414
for attrs in info.attrs.map.values() {

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ pub(crate) fn run_global_ctxt(
378378
ctxt.external_traits.insert(sized_trait_did, sized_trait);
379379
}
380380

381-
debug!("crate: {:?}", tcx.hir_krate());
381+
debug!("crate: {:?}", tcx.hir_crate(()));
382382

383383
let mut krate = tcx.sess.time("clean_crate", || clean::krate(&mut ctxt));
384384

0 commit comments

Comments
 (0)