2023-10-16 17:36:39 +00:00
|
|
|
// skip-filecheck
|
2022-04-13 09:20:46 +00:00
|
|
|
// unit-test: EarlyOtherwiseBranch
|
2020-08-01 23:47:52 +00:00
|
|
|
|
|
|
|
// must not optimize as it does not follow the pattern of
|
|
|
|
// left and right hand side being the same variant
|
|
|
|
|
|
|
|
// EMIT_MIR early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff
|
2020-09-19 21:38:54 +00:00
|
|
|
fn noopt1(x: Option<u32>, y: Option<u32>) -> u32 {
|
|
|
|
match (x, y) {
|
2020-08-01 23:47:52 +00:00
|
|
|
(Some(a), Some(b)) => 0,
|
|
|
|
(Some(a), None) => 1,
|
|
|
|
(None, Some(b)) => 2,
|
2020-09-19 21:38:54 +00:00
|
|
|
(None, None) => 3,
|
2020-08-01 23:47:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
noopt1(None, Some(0));
|
|
|
|
}
|