]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/const_prop/discriminant.rs
Rollup merge of #107770 - notriddle:notriddle/br2nl, r=GuillaumeGomez
[rust.git] / tests / mir-opt / const_prop / discriminant.rs
1 // unit-test: ConstProp
2 // compile-flags: -O
3
4 // FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with
5 // `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect`
6 // and `InterpCx::eval_place()` always forces an allocation which creates the `Indirect`.
7 // Fixing either of those will allow us to const-prop this away.
8
9 // EMIT_MIR_FOR_EACH_BIT_WIDTH
10 // EMIT_MIR discriminant.main.ConstProp.diff
11 fn main() {
12     let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
13 }