Closed
Description
Macro definitions are currently handled separately from other item kinds in HIR, either as MacroDef
nodes inside hir::Crate::exported_macros
or as using the hir::Crate::non_exported_macro_attrs
.
They should be transformed into additional variants in the hir::ItemKind
enum, and iterated over like any other item.
Instructions:
- introduce two additional variants
hir::ItemKind::ExportedMacro { ast: ast::MacroDef }
andhir::ItemKind::NonExportedMacro
; - move the macro case in
rustc_ast_lowering::item::LoweringContext::lower_item
intolower_item_kind
; - remove
hir::OwnerNode::{MacroDef, NonExportedMacro}
variants.
I recomment waiting on #83723 and #87234 to be merged.
Original idea by @petrochenkov in #83723 (comment)
Should help with #73754
Metadata
Metadata
Assignees
Labels
Area: The high-level intermediate representation (HIR)Area: Declarative macros 2.0 (#39412)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: PRs that clean code up or issues documenting cleanup.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.`#![feature(decl_macro)]`Relevant to the compiler team, which will review and decide on the PR/issue.