Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
423 B
Rust
Raw Normal View History

// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2020-05-24 21:37:09 +02:00
//! Tests that assignment in both branches of an `if` are eliminated.
// unit-test: DestinationPropagation
2020-05-24 21:37:09 +02:00
fn val() -> i32 {
1
}
fn cond() -> bool {
true
}
// EMIT_MIR branch.foo.DestinationPropagation.diff
fn foo() -> i32 {
2020-05-24 21:37:09 +02:00
let x = val();
let y = if cond() {
x
} else {
val();
x
};
y
}
fn main() {
foo();
2020-05-24 21:37:09 +02:00
}