rust/tests/mir-opt/match_test.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
440 B
Rust
Raw Normal View History

2018-12-17 07:53:22 +00:00
// Make sure redundant testing paths in `match` expressions are sorted out.
#![feature(exclusive_range_pattern)]
2020-07-27 19:22:43 +00:00
// EMIT_MIR match_test.main.SimplifyCfg-initial.after.mir
2018-12-17 07:53:22 +00:00
fn main() {
let x = 3;
let b = true;
// When `(0..=10).contains(x) && !b`, we should jump to the last arm
// without testing two other candidates.
match x {
0..10 if b => 0,
10..=20 => 1,
-1 => 2,
_ => 3,
};
}