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