-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove $:meta matcher in decl macros #49629
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The less fragment specifiers the better! We might even want to change the |
Changing macro_rules! eddyb {
($m:meta $n:tt) => {}
}
eddyb!(a ~); |
So, the only generalization we can make is to have |
I thought the idea was to support attribute invocations identical to bang macro invocations a::b::c!(tt*)
a::b::c![tt*]
a::b::c!{tt*}
=>
#[a::b::c(tt*)]
#[a::b::c[tt*]]
#[a::b::c{tt*}] + two "legacy" forms #[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
In this case, I think, we can fit it into existing |
This seems like something that should get done for Rust 2018 -- Should this be nominated for more discussion? |
#50120 restricted the attribute grammar to delimited token trees, so it's at least technically possible to keep |
#63674 supports the modern attribute syntax in |
syntax: Support modern attribute syntax in the `meta` matcher Where "modern" means #57367: ``` PATH PATH `(` TOKEN_STREAM `)` PATH `[` TOKEN_STREAM `]` PATH `{` TOKEN_STREAM `}` ``` Unfortunately, `meta` wasn't future-proofed using the `FOLLOW` token set like other matchers (#34011), so code like `$meta:meta {` or `$meta:meta [` may break, and we need a crater run to find out how often this happens in practice. Closes #49629 (by fully supporting `meta` rather than removing it.)
syntax: Support modern attribute syntax in the `meta` matcher Where "modern" means rust-lang#57367: ``` PATH PATH `(` TOKEN_STREAM `)` PATH `[` TOKEN_STREAM `]` PATH `{` TOKEN_STREAM `}` ``` Unfortunately, `meta` wasn't future-proofed using the `FOLLOW` token set like other matchers (rust-lang#34011), so code like `$meta:meta {` or `$meta:meta [` may break, and we need a crater run to find out how often this happens in practice. Closes rust-lang#49629 (by fully supporting `meta` rather than removing it.)
$:meta
is intended for matching the content of attributes, as in the following: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 text was updated successfully, but these errors were encountered: