]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/pat-tuple-3.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / binding / pat-tuple-3.rs
1 // run-pass
2 fn tuple() {
3     let x = (1, 2, 3);
4     let branch = match x {
5         (1, 1, ..) => 0,
6         (1, 2, 3, ..) => 1,
7         (1, 2, ..) => 2,
8         _ => 3
9     };
10     assert_eq!(branch, 1);
11 }
12
13 fn tuple_struct() {
14     struct S(u8, u8, u8);
15
16     let x = S(1, 2, 3);
17     let branch = match x {
18         S(1, 1, ..) => 0,
19         S(1, 2, 3, ..) => 1,
20         S(1, 2, ..) => 2,
21         _ => 3
22     };
23     assert_eq!(branch, 1);
24 }
25
26 fn main() {
27     tuple();
28     tuple_struct();
29 }