]>
Commit | Line | Data |
---|---|---|
064997fb FG |
1 | // EMIT_MIR enum_cast.foo.mir_map.0.mir |
2 | // EMIT_MIR enum_cast.bar.mir_map.0.mir | |
3 | // EMIT_MIR enum_cast.boo.mir_map.0.mir | |
4 | ||
5 | enum Foo { | |
6 | A | |
7 | } | |
8 | ||
9 | enum Bar { | |
10 | A, B | |
11 | } | |
12 | ||
13 | #[repr(u8)] | |
14 | enum Boo { | |
15 | A, B | |
16 | } | |
17 | ||
18 | fn foo(foo: Foo) -> usize { | |
19 | foo as usize | |
20 | } | |
21 | ||
22 | fn bar(bar: Bar) -> usize { | |
23 | bar as usize | |
24 | } | |
25 | ||
26 | fn boo(boo: Boo) -> usize { | |
27 | boo as usize | |
28 | } | |
29 | ||
30 | // EMIT_MIR enum_cast.droppy.mir_map.0.mir | |
31 | enum Droppy { | |
32 | A, B, C | |
33 | } | |
34 | ||
35 | impl Drop for Droppy { | |
36 | fn drop(&mut self) {} | |
37 | } | |
38 | ||
39 | fn droppy() { | |
40 | { | |
41 | let x = Droppy::C; | |
42 | // remove this entire test once `cenum_impl_drop_cast` becomes a hard error | |
43 | #[allow(cenum_impl_drop_cast)] | |
44 | let y = x as usize; | |
45 | } | |
46 | let z = Droppy::B; | |
47 | } | |
48 | ||
49 | fn main() { | |
50 | } |