blob: 71cc90e8bd170aef13720b8ae0b2415f968dbbff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// run-pass
#![allow(dead_code)]
enum FooMode {
Check = 0x1001,
}
enum BarMode {
Check = 0x2001,
}
enum Mode {
Foo(FooMode),
Bar(BarMode),
}
#[inline(never)]
fn broken(mode: &Mode) -> u32 {
for _ in 0..1 {
if let Mode::Foo(FooMode::Check) = *mode { return 17 }
if let Mode::Bar(BarMode::Check) = *mode { return 19 }
}
return 42;
}
fn main() {
let mode = Mode::Bar(BarMode::Check);
assert_eq!(broken(&mode), 19);
}
|