replace hir().def_kind for def_kind query in rustc_passes
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
parent
90685c6333
commit
eea16de9f7
@ -88,7 +88,7 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||
|
||||
fn check_item<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
|
||||
let _: Option<_> = try {
|
||||
if !matches!(tcx.hir().def_kind(id.def_id), DefKind::Impl) {
|
||||
if !matches!(tcx.def_kind(id.def_id), DefKind::Impl) {
|
||||
None?
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ fn check_item<'tcx>(
|
||||
worklist.push(id.def_id);
|
||||
}
|
||||
|
||||
match tcx.hir().def_kind(id.def_id) {
|
||||
match tcx.def_kind(id.def_id) {
|
||||
DefKind::Enum => {
|
||||
let item = tcx.hir().item(id);
|
||||
if let hir::ItemKind::Enum(ref enum_def, _) = item.kind {
|
||||
@ -544,7 +544,7 @@ fn check_item<'tcx>(
|
||||
|
||||
fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, worklist: &mut Vec<LocalDefId>, id: hir::TraitItemId) {
|
||||
use hir::TraitItemKind::{Const, Fn};
|
||||
if matches!(tcx.hir().def_kind(id.def_id), DefKind::AssocConst | DefKind::AssocFn) {
|
||||
if matches!(tcx.def_kind(id.def_id), DefKind::AssocConst | DefKind::AssocFn) {
|
||||
let trait_item = tcx.hir().trait_item(id);
|
||||
if matches!(trait_item.kind, Const(_, Some(_)) | Fn(_, hir::TraitFn::Provided(_)))
|
||||
&& has_allow_dead_code_or_lang_attr(tcx, trait_item.hir_id())
|
||||
@ -559,7 +559,7 @@ fn check_foreign_item<'tcx>(
|
||||
worklist: &mut Vec<LocalDefId>,
|
||||
id: hir::ForeignItemId,
|
||||
) {
|
||||
if matches!(tcx.hir().def_kind(id.def_id), DefKind::Static(_) | DefKind::Fn)
|
||||
if matches!(tcx.def_kind(id.def_id), DefKind::Static(_) | DefKind::Fn)
|
||||
&& has_allow_dead_code_or_lang_attr(tcx, id.hir_id())
|
||||
{
|
||||
worklist.push(id.def_id);
|
||||
|
@ -82,7 +82,7 @@ fn find_item(id: ItemId, ctxt: &mut EntryContext<'_>) {
|
||||
|
||||
match entry_point_type(ctxt, id, at_root) {
|
||||
EntryPointType::None => (),
|
||||
_ if !matches!(ctxt.tcx.hir().def_kind(id.def_id), DefKind::Fn) => {
|
||||
_ if !matches!(ctxt.tcx.def_kind(id.def_id), DefKind::Fn) => {
|
||||
let attrs = ctxt.tcx.hir().attrs(id.hir_id());
|
||||
if let Some(attr) = ctxt.tcx.sess.find_by_name(attrs, sym::start) {
|
||||
throw_attr_err(&ctxt.tcx.sess, attr.span, "start");
|
||||
|
Loading…
Reference in New Issue
Block a user