]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/early_otherwise_branch_noopt.rs
Rollup merge of #107473 - rustbot:docs-update, r=ehuss
[rust.git] / tests / mir-opt / early_otherwise_branch_noopt.rs
1 // unit-test: EarlyOtherwiseBranch
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 }