]> git.proxmox.com Git - rustc.git/blob - src/test/ui/binding/pat-tuple-6.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / binding / pat-tuple-6.rs
1 // run-pass
2 fn tuple() {
3 let x = (1, 2, 3, 4, 5);
4 match x {
5 (a, .., b, c) => {
6 assert_eq!(a, 1);
7 assert_eq!(b, 4);
8 assert_eq!(c, 5);
9 }
10 }
11 match x {
12 (a, b, c, .., d) => {
13 assert_eq!(a, 1);
14 assert_eq!(b, 2);
15 assert_eq!(c, 3);
16 assert_eq!(d, 5);
17 }
18 }
19 }
20
21 fn tuple_struct() {
22 struct S(u8, u8, u8, u8, u8);
23
24 let x = S(1, 2, 3, 4, 5);
25 match x {
26 S(a, .., b, c) => {
27 assert_eq!(a, 1);
28 assert_eq!(b, 4);
29 assert_eq!(c, 5);
30 }
31 }
32 match x {
33 S(a, b, c, .., d) => {
34 assert_eq!(a, 1);
35 assert_eq!(b, 2);
36 assert_eq!(c, 3);
37 assert_eq!(d, 5);
38 }
39 }
40 }
41
42 fn main() {
43 tuple();
44 tuple_struct();
45 }