2025-05-15 19:09:13 +00:00
|
|
|
//@ run-fail
|
|
|
|
|
//@ compile-flags: -C debug-assertions
|
2025-07-02 20:33:28 +03:00
|
|
|
//@ error-pattern: trying to construct an enum from an invalid value
|
2025-05-15 19:09:13 +00:00
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
#[repr(u16)]
|
|
|
|
|
enum Mix {
|
|
|
|
|
A,
|
|
|
|
|
B(u16),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
enum Nested {
|
|
|
|
|
C(Mix),
|
|
|
|
|
D,
|
|
|
|
|
E,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2025-07-02 20:33:28 +03:00
|
|
|
let _val: Nested = unsafe { std::mem::transmute::<u32, Nested>(u32::MAX) };
|
2025-05-15 19:09:13 +00:00
|
|
|
}
|