about summary refs log tree commit diff
path: root/tests/ui/mir/enum/plain_no_data_break.rs
blob: 966dd641873ed538db5a758be95bc23c9fb9e977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ run-crash
//@ compile-flags: -C debug-assertions
//@ error-pattern: trying to construct an enum from an invalid value 0x1

#[repr(u32)]
#[allow(dead_code)]
enum Foo {
    A = 2,
    B,
}

fn main() {
    let _val: Foo = unsafe { std::mem::transmute::<u32, Foo>(1) };
}