Closed
Description
If we generate the MIR for
fn black_box<T>(t: T) -> T { t }
fn main() {
let x = black_box(42);
let y = if x == 43 {
"foo"
} else {
"bar"
};
}
we get something like
_3 = Eq(move _4, const 43i32);
StorageDead(_4);
switchInt(_3) -> [false: bb2, otherwise: bb3];
which we could also write as
switchInt(_4) -> [43i32: bb3, otherwise: bb2];
(plus move the StorageDead
to the beginning of bb2
and bb3
). The same goes for !=
(Ne
).
cc @rust-lang/wg-mir-opt