]> git.lizzy.rs Git - rust.git/blob - unreachable.rs
32b5def984a8053614e071fe22a8199bb6eb9458
[rust.git] / unreachable.rs
1 // Check that unreachable code is removed after the destination propagation.
2 // Regression test for issue #105428.
3 //
4 // compile-flags: --crate-type=lib -Zmir-opt-level=0
5 // compile-flags: -Zmir-enable-passes=+ConstProp,+SimplifyConstCondition-after-const-prop,+DestinationPropagation
6
7 // EMIT_MIR unreachable.f.DestinationPropagation.diff
8 pub fn f<T: Copy>(a: T) {
9     let b = a;
10     if false {
11         g(a, b);
12     } else {
13         g(b, b);
14     }
15 }
16
17 #[inline(never)]
18 pub fn g<T: Copy>(_: T, _: T) {}