-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Macro literal fragment specifiers should forward to exact tokens #124989
Copy link
Copy link
Open
Labels
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, ..)A-maybe-future-editionSomething we may consider for a future edition.Something we may consider for a future edition.T-langRelevant to the language teamRelevant to the language teamWG-macrosWorking group: MacrosWorking group: Macros
Metadata
Metadata
Assignees
Labels
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, ..)A-maybe-future-editionSomething we may consider for a future edition.Something we may consider for a future edition.T-langRelevant to the language teamRelevant to the language teamWG-macrosWorking group: MacrosWorking group: Macros
Type
Fields
Give feedbackNo fields configured for issues without a type.
Motivating example (playground link):
The above fails to compile because
literaldoes not forward to exact matches, but it doesn't seem like there is any reason it shouldn't.identorttcan be used, but loosening restrictions can cause other problems.This probably couldn't be changed without an edition depending on fallout, but we can probably make sure this works with macros 2.0.
The reference makes a comment about forwarding here: https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment