]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/vec-matching-fixed.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / ui / array-slice-vec / vec-matching-fixed.rs
1 // run-pass
2
3 fn a() {
4     let x = [1, 2, 3];
5     match x {
6         [1, 2, 4] => unreachable!(),
7         [0, 2, 3, ..] => unreachable!(),
8         [0, .., 3] => unreachable!(),
9         [0, ..] => unreachable!(),
10         [1, 2, 3] => (),
11         [_, _, _] => unreachable!(),
12     }
13     match x {
14         [..] => (),
15     }
16     match x {
17         [_, _, _, ..] => (),
18     }
19     match x {
20         [a, b, c] => {
21             assert_eq!(1, a);
22             assert_eq!(2, b);
23             assert_eq!(3, c);
24         }
25     }
26 }
27
28 pub fn main() {
29     a();
30 }