2021-03-04 07:21:13 -06:00
|
|
|
// compile-flags: -Z mir-opt-level=4
|
2020-08-01 18:47:52 -05:00
|
|
|
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
|
2020-09-19 16:38:54 -05:00
|
|
|
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
|
|
|
|
match (x, y) {
|
2020-08-01 18:47:52 -05:00
|
|
|
(Some(a), Some(b)) => 0,
|
2020-09-19 16:38:54 -05:00
|
|
|
_ => 1,
|
2020-08-01 18:47:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// EMIT_MIR early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff
|
2020-09-19 16:38:54 -05:00
|
|
|
fn opt2(x: Option<u32>, y: Option<u32>) -> u32 {
|
|
|
|
match (x, y) {
|
2020-08-01 18:47:52 -05:00
|
|
|
(Some(a), Some(b)) => 0,
|
|
|
|
(None, None) => 0,
|
2020-09-19 16:38:54 -05:00
|
|
|
_ => 1,
|
2020-08-01 18:47:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
opt1(None, Some(0));
|
|
|
|
opt2(None, Some(0));
|
|
|
|
}
|