Skip to content

Commit eea16de

Browse files
committed
replace hir().def_kind for def_kind query in rustc_passes
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
1 parent 90685c6 commit eea16de

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler/rustc_passes/src/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub(crate) fn provide(providers: &mut Providers) {
8888

8989
fn check_item<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
9090
let _: Option<_> = try {
91-
if !matches!(tcx.hir().def_kind(id.def_id), DefKind::Impl) {
91+
if !matches!(tcx.def_kind(id.def_id), DefKind::Impl) {
9292
None?
9393
}
9494

compiler/rustc_passes/src/dead.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ fn check_item<'tcx>(
491491
worklist.push(id.def_id);
492492
}
493493

494-
match tcx.hir().def_kind(id.def_id) {
494+
match tcx.def_kind(id.def_id) {
495495
DefKind::Enum => {
496496
let item = tcx.hir().item(id);
497497
if let hir::ItemKind::Enum(ref enum_def, _) = item.kind {
@@ -544,7 +544,7 @@ fn check_item<'tcx>(
544544

545545
fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, worklist: &mut Vec<LocalDefId>, id: hir::TraitItemId) {
546546
use hir::TraitItemKind::{Const, Fn};
547-
if matches!(tcx.hir().def_kind(id.def_id), DefKind::AssocConst | DefKind::AssocFn) {
547+
if matches!(tcx.def_kind(id.def_id), DefKind::AssocConst | DefKind::AssocFn) {
548548
let trait_item = tcx.hir().trait_item(id);
549549
if matches!(trait_item.kind, Const(_, Some(_)) | Fn(_, hir::TraitFn::Provided(_)))
550550
&& has_allow_dead_code_or_lang_attr(tcx, trait_item.hir_id())
@@ -559,7 +559,7 @@ fn check_foreign_item<'tcx>(
559559
worklist: &mut Vec<LocalDefId>,
560560
id: hir::ForeignItemId,
561561
) {
562-
if matches!(tcx.hir().def_kind(id.def_id), DefKind::Static(_) | DefKind::Fn)
562+
if matches!(tcx.def_kind(id.def_id), DefKind::Static(_) | DefKind::Fn)
563563
&& has_allow_dead_code_or_lang_attr(tcx, id.hir_id())
564564
{
565565
worklist.push(id.def_id);

compiler/rustc_passes/src/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn find_item(id: ItemId, ctxt: &mut EntryContext<'_>) {
8282

8383
match entry_point_type(ctxt, id, at_root) {
8484
EntryPointType::None => (),
85-
_ if !matches!(ctxt.tcx.hir().def_kind(id.def_id), DefKind::Fn) => {
85+
_ if !matches!(ctxt.tcx.def_kind(id.def_id), DefKind::Fn) => {
8686
let attrs = ctxt.tcx.hir().attrs(id.hir_id());
8787
if let Some(attr) = ctxt.tcx.sess.find_by_name(attrs, sym::start) {
8888
throw_attr_err(&ctxt.tcx.sess, attr.span, "start");

0 commit comments

Comments
 (0)