]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/early_otherwise_branch_noopt.rs
Rollup merge of #92528 - tmiasko:combine-commutative, r=michaelwoerister
[rust.git] / src / test / mir-opt / early_otherwise_branch_noopt.rs
1 // compile-flags: -Z mir-opt-level=4 -Zunsound-mir-opts
2
3 // must not optimize as it does not follow the pattern of
4 // left and right hand side being the same variant
5
6 // EMIT_MIR early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff
7 fn noopt1(x: Option<u32>, y: Option<u32>) -> u32 {
8     match (x, y) {
9         (Some(a), Some(b)) => 0,
10         (Some(a), None) => 1,
11         (None, Some(b)) => 2,
12         (None, None) => 3,
13     }
14 }
15
16 fn main() {
17     noopt1(None, Some(0));
18 }