summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs
blob: 48a679b2d098dd9d561ecee33b4d1af0ecb2ef33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
fn main() {}

macro_rules! expand_to_enum {
    () => {
        enum BadE {}
        //~^ ERROR enum is not supported in `trait`s or `impl`s
        //~| ERROR enum is not supported in `trait`s or `impl`s
        //~| ERROR enum is not supported in `extern` blocks
    };
}

macro_rules! mac_impl {
    ($($i:item)*) => {
        struct S;
        impl S { $($i)* }
    }
}

mac_impl! {
    struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
    expand_to_enum!();
}

macro_rules! mac_trait {
    ($($i:item)*) => {
        trait T { $($i)* }
    }
}

mac_trait! {
    struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
    expand_to_enum!();
}

macro_rules! mac_extern {
    ($($i:item)*) => {
        extern "C" { $($i)* }
    }
}

mac_extern! {
    struct BadS; //~ ERROR struct is not supported in `extern` blocks
    expand_to_enum!();
}