]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/match_test.rs
Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk
[rust.git] / tests / mir-opt / match_test.rs
1 // Make sure redundant testing paths in `match` expressions are sorted out.
2
3 #![feature(exclusive_range_pattern)]
4
5 // EMIT_MIR match_test.main.SimplifyCfg-initial.after.mir
6 fn main() {
7     let x = 3;
8     let b = true;
9
10     // When `(0..=10).contains(x) && !b`, we should jump to the last arm
11     // without testing two other candidates.
12     match x {
13         0..10 if b => 0,
14         10..=20 => 1,
15         -1 => 2,
16         _ => 3,
17     };
18 }