]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/bool_compare.rs
Do not eagerly recover for bad impl-trait in macros
[rust.git] / tests / mir-opt / bool_compare.rs
1 // unit-test: InstCombine
2
3 // EMIT_MIR bool_compare.opt1.InstCombine.diff
4 fn opt1(x: bool) -> u32 {
5     if x != true { 0 } else { 1 }
6 }
7
8 // EMIT_MIR bool_compare.opt2.InstCombine.diff
9 fn opt2(x: bool) -> u32 {
10     if true != x { 0 } else { 1 }
11 }
12
13 // EMIT_MIR bool_compare.opt3.InstCombine.diff
14 fn opt3(x: bool) -> u32 {
15     if x == false { 0 } else { 1 }
16 }
17
18 // EMIT_MIR bool_compare.opt4.InstCombine.diff
19 fn opt4(x: bool) -> u32 {
20     if false == x { 0 } else { 1 }
21 }
22
23 fn main() {
24     opt1(false);
25     opt2(false);
26     opt3(false);
27     opt4(false);
28 }