about summary refs log tree commit diff
path: root/tests/ui/mir/enum/negative_discr_break.rs
blob: 35ee8aa3fc853b4ed9e794085a52a0abd2408471 (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 0xfd

#[allow(dead_code)]
enum Foo {
    A = -2,
    B = -1,
    C = 1,
}

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