]> git.proxmox.com Git - rustc.git/blame - tests/mir-opt/match_test.rs
New upstream version 1.75.0+dfsg1
[rustc.git] / tests / mir-opt / match_test.rs
CommitLineData
ed00b5ec 1// skip-filecheck
0731742a
XL
2// Make sure redundant testing paths in `match` expressions are sorted out.
3
4#![feature(exclusive_range_pattern)]
5
3dfed10e 6// EMIT_MIR match_test.main.SimplifyCfg-initial.after.mir
0731742a
XL
7fn main() {
8 let x = 3;
9 let b = true;
10
11 // When `(0..=10).contains(x) && !b`, we should jump to the last arm
12 // without testing two other candidates.
13 match x {
14 0..10 if b => 0,
15 10..=20 => 1,
16 -1 => 2,
17 _ => 3,
18 };
19}