1
Fork 0

resolve: Fix incorrect results of opt_def_kind query for some built-in macros

Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
This commit is contained in:
Vadim Petrochenkov 2021-12-11 19:52:23 +08:00
parent 4b043faba3
commit 17b1afdbb2
17 changed files with 35 additions and 19 deletions

View file

@ -564,7 +564,7 @@ impl<'tcx> EmbargoVisitor<'tcx> {
// privacy and mark them reachable.
DefKind::Macro(_) => {
let item = self.tcx.hir().expect_item(def_id);
if let hir::ItemKind::Macro(MacroDef { macro_rules: false, .. }) = item.kind {
if let hir::ItemKind::Macro(MacroDef { macro_rules: false, .. }, _) = item.kind {
if vis.is_accessible_from(module.to_def_id(), self.tcx) {
self.update(def_id, level);
}
@ -686,7 +686,7 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
}
}
}
hir::ItemKind::Macro(ref macro_def) => {
hir::ItemKind::Macro(ref macro_def, _) => {
self.update_reachability_from_macro(item.def_id, macro_def);
}
hir::ItemKind::ForeignMod { items, .. } => {