diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-29 16:45:48 -0400 |
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-05-06 12:11:05 -0400 |
| commit | 91ef3ba71d36c17eafd8d582d348d96b8148fbd9 (patch) | |
| tree | fed7c4160c387907aa2d4952fe6d999f84c078e7 | |
| parent | 3afc5ea2010342f38fa771e9b81438249416f252 (diff) | |
| download | rust-91ef3ba71d36c17eafd8d582d348d96b8148fbd9.tar.gz rust-91ef3ba71d36c17eafd8d582d348d96b8148fbd9.zip | |
remove all usages of hir().def_kind
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/mod.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs | 2 |
3 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 85e53559c29..895cd4f0eac 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -308,11 +308,6 @@ impl<'hir> Map<'hir> { Some(def_kind) } - pub fn def_kind(self, local_def_id: LocalDefId) -> DefKind { - self.opt_def_kind(local_def_id) - .unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", local_def_id)) - } - pub fn find_parent_node(self, id: HirId) -> Option<HirId> { if id.local_id == ItemLocalId::from_u32(0) { Some(self.tcx.hir_owner_parent(id.owner)) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 991666908f9..eed90337c0a 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2676,7 +2676,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N // Iterate all local crate items no matter where they are defined. let hir = tcx.hir(); for id in hir.items() { - if matches!(hir.def_kind(id.def_id), DefKind::Use) { + if matches!(tcx.def_kind(id.def_id), DefKind::Use) { continue; } diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs b/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs index 681d1e37f86..ceb862b474a 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs @@ -151,7 +151,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } Some(Node::Ctor(hir::VariantData::Tuple(fields, _))) => { sugg_call = fields.iter().map(|_| "_").collect::<Vec<_>>().join(", "); - match def_id.as_local().map(|def_id| hir.def_kind(def_id)) { + match def_id.as_local().map(|def_id| self.tcx.def_kind(def_id)) { Some(DefKind::Ctor(hir::def::CtorOf::Variant, _)) => { msg = "instantiate this tuple variant"; } |
