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

#[allow(dead_code)]
enum Foo {
    A,
    B,
}

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