Skip to content

Commit 91ef3ba

Browse files
committed
remove all usages of hir().def_kind
Signed-off-by: Miguel Guarniz <[email protected]>
1 parent 3afc5ea commit 91ef3ba

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,6 @@ impl<'hir> Map<'hir> {
308308
Some(def_kind)
309309
}
310310

311-
pub fn def_kind(self, local_def_id: LocalDefId) -> DefKind {
312-
self.opt_def_kind(local_def_id)
313-
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", local_def_id))
314-
}
315-
316311
pub fn find_parent_node(self, id: HirId) -> Option<HirId> {
317312
if id.local_id == ItemLocalId::from_u32(0) {
318313
Some(self.tcx.hir_owner_parent(id.owner))

compiler/rustc_middle/src/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
26762676
// Iterate all local crate items no matter where they are defined.
26772677
let hir = tcx.hir();
26782678
for id in hir.items() {
2679-
if matches!(hir.def_kind(id.def_id), DefKind::Use) {
2679+
if matches!(tcx.def_kind(id.def_id), DefKind::Use) {
26802680
continue;
26812681
}
26822682

compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
151151
}
152152
Some(Node::Ctor(hir::VariantData::Tuple(fields, _))) => {
153153
sugg_call = fields.iter().map(|_| "_").collect::<Vec<_>>().join(", ");
154-
match def_id.as_local().map(|def_id| hir.def_kind(def_id)) {
154+
match def_id.as_local().map(|def_id| self.tcx.def_kind(def_id)) {
155155
Some(DefKind::Ctor(hir::def::CtorOf::Variant, _)) => {
156156
msg = "instantiate this tuple variant";
157157
}

0 commit comments

Comments
 (0)