]> git.lizzy.rs Git - rust.git/blob - tests/ui/half-open-range-patterns/range_pat_interactions0.rs
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
[rust.git] / tests / ui / half-open-range-patterns / range_pat_interactions0.rs
1 // run-pass
2 #![allow(incomplete_features)]
3 #![feature(exclusive_range_pattern)]
4 #![feature(inline_const_pat)]
5
6 fn main() {
7     let mut if_lettable = vec![];
8     let mut first_or = vec![];
9     let mut or_two = vec![];
10     let mut range_from = vec![];
11     let mut bottom = vec![];
12
13     for x in -9 + 1..=(9 - 2) {
14         if let -1..=0 | 2..3 | 4 = x {
15             if_lettable.push(x)
16         }
17         match x {
18             1 | -3..0 => first_or.push(x),
19             y @ (0..5 | 6) => or_two.push(y),
20             y @ 0..const { 5 + 1 } => assert_eq!(y, 5),
21             y @ -5.. => range_from.push(y),
22             y @ ..-7 => assert_eq!(y, -8),
23             y => bottom.push(y),
24         }
25     }
26     assert_eq!(if_lettable, [-1, 0, 2, 4]);
27     assert_eq!(first_or, [-3, -2, -1, 1]);
28     assert_eq!(or_two, [0, 2, 3, 4, 6]);
29     assert_eq!(range_from, [-5, -4, 7]);
30     assert_eq!(bottom, [-7, -6]);
31 }