]> git.proxmox.com Git - rustc.git/blame - src/test/mir-opt/match_test.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / mir-opt / match_test.rs
CommitLineData
0731742a
XL
1// Make sure redundant testing paths in `match` expressions are sorted out.
2
3#![feature(exclusive_range_pattern)]
4
ba9703b0 5// EMIT_MIR rustc.main.SimplifyCfg-initial.after.mir
0731742a
XL
6fn 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}