]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
3157f602 XL |
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 | } |