Files
rust/src/test/mir-opt/dataflow-const-prop/if.rs
2022-11-07 10:35:08 +01:00

13 lines
321 B
Rust

// unit-test: DataflowConstProp
// EMIT_MIR if.main.DataflowConstProp.diff
fn main() {
// This does not work (yet). Needs perhaps additional state to track unreachability.
let a = 1;
let b = if *&a == 1 { 2 } else { 3 };
let c = b + 1;
let d = if *&a == 1 { a } else { a + 1 };
let e = d + 1;
}