summaryrefslogtreecommitdiffstats
path: root/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
blob: 192bbba5a5b3ac4b5b9e458a4b25faf5559f3fbd (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
#![allow(incomplete_features)]
#![feature(unnamed_fields)]

struct F {
    field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
    //~^ ERROR anonymous structs are unimplemented
    _: struct { field: u8 },
    //~^ ERROR anonymous structs are unimplemented
}

struct G {
    _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
}

union H {
    field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
    //~^ ERROR anonymous structs are unimplemented
    _: struct { field: u8 },
    //~^ ERROR anonymous structs are unimplemented
}

union I {
    _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
}

enum K {
    M {
        _ : struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
        //~^ ERROR unnamed fields are not allowed outside of structs or unions
        //~| ERROR anonymous structs are unimplemented
    },
    N {
        _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
    }
}

fn main() {}