Teach tools that macros are now HIR items

This commit is contained in:
inquisitivecrystal 2021-08-05 16:58:46 -07:00
parent 8c4056fd4a
commit c8262ade90
3 changed files with 9 additions and 1 deletions

View File

@ -122,8 +122,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
},
hir::ItemKind::Const(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Struct(..)
| hir::ItemKind::Trait(..)

View File

@ -118,6 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
},
hir::ItemKind::Const(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Struct(..)

View File

@ -381,6 +381,13 @@ fn print_item(cx: &LateContext<'_>, item: &hir::Item<'_>) {
let item_ty = cx.tcx.type_of(did);
println!("function of type {:#?}", item_ty);
},
hir::ItemKind::Macro(ref macro_def) => {
if macro_def.macro_rules {
println!("macro introduced by `macro_rules!`");
} else {
println!("macro introduced by `macro`");
}
},
hir::ItemKind::Mod(..) => println!("module"),
hir::ItemKind::ForeignMod { abi, .. } => println!("foreign module with abi: {}", abi),
hir::ItemKind::GlobalAsm(asm) => println!("global asm: {:?}", asm),