2023-07-22 15:34:54 +00:00
|
|
|
// unit-test: UnreachablePropagation
|
2023-06-08 07:18:34 +00:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2023-07-22 15:34:54 +00:00
|
|
|
|
2020-01-10 19:15:16 +00:00
|
|
|
enum Empty {}
|
|
|
|
|
|
|
|
fn empty() -> Option<Empty> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
|
2020-07-27 19:22:43 +00:00
|
|
|
// EMIT_MIR unreachable.main.UnreachablePropagation.diff
|
2020-01-10 19:15:16 +00:00
|
|
|
fn main() {
|
2023-07-22 15:34:54 +00:00
|
|
|
// CHECK-LABEL: fn main(
|
|
|
|
// CHECK: bb0: {
|
|
|
|
// CHECK: {{_.*}} = empty()
|
|
|
|
// CHECK: bb1: {
|
|
|
|
// CHECK: switchInt({{.*}}) -> [1: bb2, otherwise: bb6];
|
|
|
|
// CHECK: bb2: {
|
|
|
|
// CHECK: unreachable;
|
|
|
|
// CHECK: bb3: {
|
|
|
|
// CHECK: unreachable;
|
|
|
|
// CHECK: bb4: {
|
|
|
|
// CHECK: unreachable;
|
|
|
|
// CHECK: bb5: {
|
|
|
|
// CHECK: unreachable;
|
|
|
|
// CHECK: bb6: {
|
|
|
|
// CHECK: return;
|
2020-01-10 19:15:16 +00:00
|
|
|
if let Some(_x) = empty() {
|
|
|
|
let mut _y;
|
|
|
|
|
|
|
|
if true {
|
|
|
|
_y = 21;
|
|
|
|
} else {
|
|
|
|
_y = 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
match _x { }
|
|
|
|
}
|
|
|
|
}
|