about summary refs log tree commit diff
path: root/tests/ui/mir/enum/convert_non_integer_ok.rs
blob: c98315313863de70aa4227eb92072df21dd1753c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ run-pass
//@ compile-flags: -C debug-assertions

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

#[allow(dead_code)]
struct Bar {
    a: u32,
}

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