| //@ test-mir-pass: EarlyOtherwiseBranch |
| //@ compile-flags: -Zmir-enable-passes=+UnreachableEnumBranching |
| // FIXME: This test was broken by the derefer change. |
| pub enum ViewportPercentageLength { |
| // EMIT_MIR early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff |
| pub extern "C" fn try_sum( |
| x: &ViewportPercentageLength, |
| other: &ViewportPercentageLength, |
| ) -> Result<ViewportPercentageLength, ()> { |
| // CHECK-LABEL: fn try_sum( |
| // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); |
| // CHECK-NOT: discriminant |
| // CHECK: switchInt(move [[LOCAL1]]) -> [ |
| use self::ViewportPercentageLength::*; |
| (&Vw(one), &Vw(other)) => Vw(one + other), |
| (&Vh(one), &Vh(other)) => Vh(one + other), |
| (&Vmin(one), &Vmin(other)) => Vmin(one + other), |
| (&Vmax(one), &Vmax(other)) => Vmax(one + other), |
| try_sum(&ViewportPercentageLength::Vw(1.0), &ViewportPercentageLength::Vw(2.0)); |