You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to #34981 (comment) we intend to support arbitrary token streams inside of attributes rather than the limited grammar of $:meta. Let's have decl macros drop support for $:meta and encourage #[$($meta:tt)*] instead.
The less fragment specifiers the better! We might even want to change the macro_rulesmeta to ident followed by any number of tt's, just to keep things simple.
#[a::b::c]// Maybe not so "legacy" with https://internals.rust-lang.org/t/idea-elide-parens-brackets-on-unparametrized-macros/6527#[a::b::c = not_sure_what_exactly_but_probably_tt]
, but not arbitrary "token streams" (aka tt* without delimiters)
#[a::b::c e f + c ,,, ;_:] // Nope
In this case, I think, we can fit it into existing meta with all its following token rules.
Activity
eddyb commentedon Apr 3, 2018
The less fragment specifiers the better! We might even want to change the
macro_rulesmetatoidentfollowed by any number oftt's, just to keep things simple.dtolnay commentedon Apr 3, 2018
Changing
macro_rules's meta is tricky because it is currently allowed to be followed by tokens.eddyb commentedon Apr 3, 2018
So, the only generalization we can make is to have
metaallowident = ttandident(tt*)?petrochenkov commentedon Apr 3, 2018
I thought the idea was to support attribute invocations identical to bang macro invocations
+ two "legacy" forms
, but not arbitrary "token streams" (aka
tt*without delimiters)In this case, I think, we can fit it into existing
metawith all its following token rules.sgrif commentedon Aug 2, 2018
This seems like something that should get done for Rust 2018 -- Should this be nominated for more discussion?
petrochenkov commentedon Aug 2, 2018
#50120 restricted the attribute grammar to delimited token trees, so it's at least technically possible to keep
metaas a matcher now.petrochenkov commentedon Aug 17, 2019
#63674 supports the modern attribute syntax in
meta.Auto merge of #63674 - petrochenkov:meta2, r=<try>
Rollup merge of rust-lang#63674 - petrochenkov:meta2, r=Centril
Rollup merge of rust-lang#63674 - petrochenkov:meta2, r=Centril
Add documentation and make matchers more flexible