$:meta is intended for matching the content of attributes, as in the following:
#![feature(decl_macro)]
macro m(
$(#[$m:meta])*
struct $n:ident;
) {
$(#[$m])*
struct $n(usize);
}
m! {
#[derive(Debug)]
struct S;
}
fn main() {
println!("{:?}", S(1));
}
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.
$:metais 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$:metaand encourage#[$($meta:tt)*]instead.