]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/vec-matching-autoslice.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / array-slice-vec / vec-matching-autoslice.rs
1 // run-pass
2 #![allow(illegal_floating_point_literal_pattern)] // FIXME #41620
3
4 pub fn main() {
5     let x = [1, 2, 3];
6     match x {
7         [2, _, _] => panic!(),
8         [1, a, b] => {
9             assert_eq!([a, b], [2, 3]);
10         }
11         [_, _, _] => panic!(),
12     }
13
14     let y = ([(1, true), (2, false)], 0.5f64);
15     match y {
16         ([(1, a), (b, false)], _) => {
17             assert_eq!(a, true);
18             assert_eq!(b, 2);
19         }
20         ([_, _], 0.5) => panic!(),
21         ([_, _], _) => panic!(),
22     }
23 }