File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ crate_type = "lib" ]
2+ #![ feature( macro_attr) ]
3+
4+ macro_rules! attr {
5+ attr[ $( $args: tt) * ] { $( $body: tt) * } => {
6+ //~^ ERROR: macro attribute argument matchers require parentheses
7+ //~v ERROR: attr:
8+ compile_error!( concat!(
9+ "attr: args=\" " ,
10+ stringify!( $( $args) * ) ,
11+ "\" body=\" " ,
12+ stringify!( $( $body) * ) ,
13+ "\" " ,
14+ ) ) ;
15+ } ;
16+ }
17+
18+ #[ attr]
19+ struct S ;
Original file line number Diff line number Diff line change 1+ error: macro attribute argument matchers require parentheses
2+ --> $DIR/macro-attr-recovery.rs:5:9
3+ |
4+ LL | attr[$($args:tt)*] { $($body:tt)* } => {
5+ | ^^^^^^^^^^^^^^
6+ |
7+ help: the delimiters should be `(` and `)`
8+ |
9+ LL - attr[$($args:tt)*] { $($body:tt)* } => {
10+ LL + attr($($args:tt)*) { $($body:tt)* } => {
11+ |
12+
13+ error: attr: args="" body="struct S;"
14+ --> $DIR/macro-attr-recovery.rs:8:9
15+ |
16+ LL | / compile_error!(concat!(
17+ LL | | "attr: args=\"",
18+ LL | | stringify!($($args)*),
19+ LL | | "\" body=\"",
20+ LL | | stringify!($($body)*),
21+ LL | | "\"",
22+ LL | | ));
23+ | |__________^
24+ ...
25+ LL | #[attr]
26+ | ------- in this attribute macro expansion
27+ |
28+ = note: this error originates in the attribute macro `attr` (in Nightly builds, run with -Z macro-backtrace for more info)
29+
30+ error: aborting due to 2 previous errors
31+
You can’t perform that action at this time.
0 commit comments