]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs
Rollup merge of #106958 - jyn514:labels, r=m-ou-se
[rust.git] / tests / ui / parser / issues / issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs
1 fn main() {}
2
3 macro_rules! expand_to_enum {
4     () => {
5         enum BadE {}
6         //~^ ERROR enum is not supported in `trait`s or `impl`s
7         //~| ERROR enum is not supported in `trait`s or `impl`s
8         //~| ERROR enum is not supported in `extern` blocks
9     };
10 }
11
12 macro_rules! mac_impl {
13     ($($i:item)*) => {
14         struct S;
15         impl S { $($i)* }
16     }
17 }
18
19 mac_impl! {
20     struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
21     expand_to_enum!();
22 }
23
24 macro_rules! mac_trait {
25     ($($i:item)*) => {
26         trait T { $($i)* }
27     }
28 }
29
30 mac_trait! {
31     struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
32     expand_to_enum!();
33 }
34
35 macro_rules! mac_extern {
36     ($($i:item)*) => {
37         extern "C" { $($i)* }
38     }
39 }
40
41 mac_extern! {
42     struct BadS; //~ ERROR struct is not supported in `extern` blocks
43     expand_to_enum!();
44 }