]>
Commit | Line | Data |
---|---|---|
136023e0 XL |
1 | // run-pass |
2 | #![allow(incomplete_features)] | |
3 | #![feature(exclusive_range_pattern)] | |
4 | #![feature(half_open_range_patterns)] | |
3c0e092e | 5 | #![feature(inline_const_pat)] |
136023e0 XL |
6 | |
7 | fn main() { | |
8 | let mut if_lettable = vec![]; | |
9 | let mut first_or = vec![]; | |
10 | let mut or_two = vec![]; | |
11 | let mut range_from = vec![]; | |
12 | let mut bottom = vec![]; | |
13 | ||
14 | for x in -9 + 1..=(9 - 2) { | |
15 | if let -1..=0 | 2..3 | 4 = x { | |
16 | if_lettable.push(x) | |
17 | } | |
18 | match x { | |
19 | 1 | -3..0 => first_or.push(x), | |
20 | y @ (0..5 | 6) => or_two.push(y), | |
21 | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), | |
22 | y @ -5.. => range_from.push(y), | |
23 | y @ ..-7 => assert_eq!(y, -8), | |
24 | y => bottom.push(y), | |
25 | } | |
26 | } | |
27 | assert_eq!(if_lettable, [-1, 0, 2, 4]); | |
28 | assert_eq!(first_or, [-3, -2, -1, 1]); | |
29 | assert_eq!(or_two, [0, 2, 3, 4, 6]); | |
30 | assert_eq!(range_from, [-5, -4, 7]); | |
31 | assert_eq!(bottom, [-7, -6]); | |
32 | } |