about summary refs log tree commit diff
path: root/tests/ui/lint/ice-const-prop-unions-known-panics-lint-123710.rs
blob: 2b93d0f8a609d8a29f4eb44032bee6c3cf76dd3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Regression test for issue 123710.
// Tests that the we do not ICE in KnownPanicsLint
// when a union contains an enum with an repr(packed),
// which is a repr not supported for enums

#[repr(packed)]
//~^ ERROR attribute should be applied to a struct or union
#[repr(u32)]
enum E {
    A,
    B,
    C,
}

fn main() {
    union InvalidTag {
        int: u32,
        e: E,
//~^ ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
    }
    let _invalid_tag = InvalidTag { int: 4 };
}