]>
Commit | Line | Data |
---|---|---|
6a06907d XL |
1 | // compile-flags: -O |
2 | #![crate_type = "lib"] | |
3 | ||
4 | // Test that LLVM can eliminate the unreachable `All::None` branch. | |
5 | ||
6 | pub enum All { | |
7 | None, | |
8 | Foo, | |
9 | Bar, | |
10 | } | |
11 | ||
12 | // CHECK-LABEL: @issue_73031 | |
13 | #[no_mangle] | |
14 | pub fn issue_73031(a: &mut All, q: i32) -> i32 { | |
15 | *a = if q == 5 { | |
16 | All::Foo | |
17 | } else { | |
18 | All::Bar | |
19 | }; | |
20 | match *a { | |
21 | // CHECK-NOT: panic | |
22 | All::None => panic!(), | |
23 | All::Foo => 1, | |
24 | All::Bar => 2, | |
25 | } | |
26 | } |