-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Tracking issue for declarative macros 2.0 (aka macro aka decl_macro aka macros-by-example).
RFC: https://rust-lang.github.io/rfcs/1584-macros.html
RFC PR: rust-lang/rfcs#1584
cc @rust-lang/compiler
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Tasks
- Complete the draft hygiene prototype and RFC.
- Hygiene for items, explicit imports, lexical scopes, and module scopes.
- Hygiene for globs and trait methods (w.r.t. extension trait candidates in scope for a method call).
- Hygiene for type directed name resolutions (i.e. methods, associated types, and fields).
- Support
macroin blocks as well as modules. - Implement inter-crate hygiene, except for nested
macros. - Implement "hygiene bending" for when users want a name from macro def to "escape".
- Implement inter-crate hygiene for nested
macros (pending macro def encoding). - Make
private_in_publichygienic? - Make
unsafeand lints hygienic (if appropriate)?
- Add variant
ast::ItemKind::MacroDefformacro_rules!items andmacroitems (PR syntax: addast::ItemKind::MacroDef, simplify hygiene info #40220). - Encode
macros in the crate metadata usingTokenStream, notString. - Fix Inferred types should be checked for privacy violations #30476 (
private_in_publicdetails). - Fix span issues If an error is not affected by a macro, don't print macro notes #30506 and Spans for Paths can be incorrect #39450 (PR macros: improve
Span's expansion information #40597). - Land
macrobehind a feature gate (PR Initial implementation of declarative macros 2.0 #40847). - Future-proof matchers (e.g.
$e:expr) by employing a simpler, more general grammar. - Allow fragments (e.g.
$ewhere$e:expr) to be parsed in more contexts (c.f. Macro matching is incorrect for macros invoked in macro expansions #26361). - Decide whether we want macro invocations in identifier positions and/or eager expansion.
-
Remove $:meta matcher (Remove $:meta matcher in decl macros #49629)
Potentially blocking issues: