rust/tests/mir-opt/match_test.rs

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

20 lines
458 B
Rust
Raw Normal View History

// skip-filecheck
2018-12-17 01:53:22 -06:00
// Make sure redundant testing paths in `match` expressions are sorted out.
#![feature(exclusive_range_pattern)]
2020-07-27 14:22:43 -05:00
// EMIT_MIR match_test.main.SimplifyCfg-initial.after.mir
2018-12-17 01:53:22 -06: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,
};
}