-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Macro definitions should be regular HIR items #87406
Copy link
Copy link
Closed
Labels
A-HIRArea: The high-level intermediate representation (HIR)Area: The high-level intermediate representation (HIR)A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-decl_macro`#![feature(decl_macro)]``#![feature(decl_macro)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-HIRArea: The high-level intermediate representation (HIR)Area: The high-level intermediate representation (HIR)A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-decl_macro`#![feature(decl_macro)]``#![feature(decl_macro)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Macro definitions are currently handled separately from other item kinds in HIR, either as
MacroDefnodes insidehir::Crate::exported_macrosor as using thehir::Crate::non_exported_macro_attrs.They should be transformed into additional variants in the
hir::ItemKindenum, and iterated over like any other item.Instructions:
hir::ItemKind::ExportedMacro { ast: ast::MacroDef }andhir::ItemKind::NonExportedMacro;rustc_ast_lowering::item::LoweringContext::lower_itemintolower_item_kind;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