Skip to content

Commit cfa8483

Browse files
authored
Rollup merge of rust-lang#95764 - c410-f3r:metavar-test, r=petrochenkov
[macro_metavar_expr] Add tests to ensure the feature requirement These tests should have been added in the initial implementation they were unintentionally forgotten cc rust-lang#83527 r? `@petrochenkov`
2 parents b9b64b1 + 5974c18 commit cfa8483

File tree

2 files changed

+117
-1
lines changed

2 files changed

+117
-1
lines changed

src/test/ui/macros/rfc-3086-metavar-expr/required-feature.rs

+35
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,40 @@ macro_rules! count {
55
};
66
}
77

8+
macro_rules! dollar_dollar {
9+
() => {
10+
macro_rules! bar {
11+
( $$( $$any:tt )* ) => { $$( $$any )* };
12+
//~^ ERROR meta-variable expressions are unstable
13+
//~| ERROR meta-variable expressions are unstable
14+
//~| ERROR meta-variable expressions are unstable
15+
//~| ERROR meta-variable expressions are unstable
16+
}
17+
};
18+
}
19+
20+
macro_rules! index {
21+
( $( $e:stmt ),* ) => {
22+
$( ${ignore(e)} ${index()} )*
23+
//~^ ERROR meta-variable expressions are unstable
24+
//~| ERROR meta-variable expressions are unstable
25+
};
26+
}
27+
28+
macro_rules! ignore {
29+
( $( $i:stmt ),* ) => {{
30+
0 $( + 1 ${ignore(i)} )*
31+
//~^ ERROR meta-variable expressions are unstable
32+
}};
33+
}
34+
35+
macro_rules! length {
36+
( $( $e:stmt ),* ) => {
37+
$( ${ignore(e)} ${length()} )*
38+
//~^ ERROR meta-variable expressions are unstable
39+
//~| ERROR meta-variable expressions are unstable
40+
};
41+
}
42+
843
fn main() {
944
}

src/test/ui/macros/rfc-3086-metavar-expr/required-feature.stderr

+82-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,87 @@ LL | ${ count(e) }
77
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
88
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
99

10-
error: aborting due to previous error
10+
error[E0658]: meta-variable expressions are unstable
11+
--> $DIR/required-feature.rs:11:16
12+
|
13+
LL | ( $$( $$any:tt )* ) => { $$( $$any )* };
14+
| ^
15+
|
16+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
17+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
18+
19+
error[E0658]: meta-variable expressions are unstable
20+
--> $DIR/required-feature.rs:11:20
21+
|
22+
LL | ( $$( $$any:tt )* ) => { $$( $$any )* };
23+
| ^
24+
|
25+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
26+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
27+
28+
error[E0658]: meta-variable expressions are unstable
29+
--> $DIR/required-feature.rs:11:39
30+
|
31+
LL | ( $$( $$any:tt )* ) => { $$( $$any )* };
32+
| ^
33+
|
34+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
35+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
36+
37+
error[E0658]: meta-variable expressions are unstable
38+
--> $DIR/required-feature.rs:11:43
39+
|
40+
LL | ( $$( $$any:tt )* ) => { $$( $$any )* };
41+
| ^
42+
|
43+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
44+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
45+
46+
error[E0658]: meta-variable expressions are unstable
47+
--> $DIR/required-feature.rs:22:13
48+
|
49+
LL | $( ${ignore(e)} ${index()} )*
50+
| ^^^^^^^^^^^
51+
|
52+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
53+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
54+
55+
error[E0658]: meta-variable expressions are unstable
56+
--> $DIR/required-feature.rs:22:26
57+
|
58+
LL | $( ${ignore(e)} ${index()} )*
59+
| ^^^^^^^^^
60+
|
61+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
62+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
63+
64+
error[E0658]: meta-variable expressions are unstable
65+
--> $DIR/required-feature.rs:30:19
66+
|
67+
LL | 0 $( + 1 ${ignore(i)} )*
68+
| ^^^^^^^^^^^
69+
|
70+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
71+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
72+
73+
error[E0658]: meta-variable expressions are unstable
74+
--> $DIR/required-feature.rs:37:13
75+
|
76+
LL | $( ${ignore(e)} ${length()} )*
77+
| ^^^^^^^^^^^
78+
|
79+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
80+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
81+
82+
error[E0658]: meta-variable expressions are unstable
83+
--> $DIR/required-feature.rs:37:26
84+
|
85+
LL | $( ${ignore(e)} ${length()} )*
86+
| ^^^^^^^^^^
87+
|
88+
= note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
89+
= help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
90+
91+
error: aborting due to 10 previous errors
1192

1293
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)