• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // run-pass
tuple()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 
tuple_struct()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 
main()26 fn main() {
27     tuple();
28     tuple_struct();
29 }
30