]> git.lizzy.rs Git - rust.git/blob - tests/run-pass/c_enums.rs
1da35d64b8409d7d8f0f9d6e783ad177be93e8cd
[rust.git] / tests / run-pass / c_enums.rs
1 #![crate_type = "lib"]
2 #![feature(custom_attribute)]
3 #![allow(dead_code, unused_attributes)]
4
5 enum Foo {
6     Bar = 42,
7     Baz,
8     Quux = 100,
9 }
10
11 #[miri_run]
12 fn foo() -> [u8; 3] {
13     [Foo::Bar as u8, Foo::Baz as u8, Foo::Quux as u8]
14 }
15
16 #[miri_run]
17 fn unsafe_match() -> bool {
18     match unsafe { std::mem::transmute::<u8, Foo>(43) } {
19         Foo::Baz => true,
20         _ => false,
21     }
22 }