1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
struct S(u8, u8, u8);
struct M(
u8,
u8,
u8,
u8,
u8,
);
struct Z0;
struct Z1();
enum E1 {
Z0,
Z1(),
}
fn main() {
match (1, 2, 3) {
(1, 2, 3, 4) => {} //~ ERROR mismatched types
(1, 2, .., 3, 4) => {} //~ ERROR mismatched types
_ => {}
}
match S(1, 2, 3) {
S(1, 2, 3, 4) => {}
//~^ ERROR this pattern has 4 fields, but the corresponding tuple struct has 3 fields
S(1, 2, .., 3, 4) => {}
//~^ ERROR this pattern has 4 fields, but the corresponding tuple struct has 3 fields
_ => {}
}
match M(1, 2, 3, 4, 5) {
M(1, 2, 3, 4, 5, 6) => {}
//~^ ERROR this pattern has 6 fields, but the corresponding tuple struct has 5 fields
M(1,
2,
3,
4,
5,
6) => {}
//~^ ERROR this pattern has 6 fields, but the corresponding tuple struct has 5 fields
M(
1,
2,
3,
4,
5,
6,
) => {}
//~^^ ERROR this pattern has 6 fields, but the corresponding tuple struct has 5 fields
}
match Z0 {
Z0 => {}
Z0() => {} //~ ERROR expected tuple struct or tuple variant, found unit struct `Z0`
Z0(_) => {} //~ ERROR expected tuple struct or tuple variant, found unit struct `Z0`
Z0(_, _) => {} //~ ERROR expected tuple struct or tuple variant, found unit struct `Z0`
}
match Z1() {
Z1 => {} //~ ERROR match bindings cannot shadow tuple structs
Z1() => {}
Z1(_) => {} //~ ERROR this pattern has 1 field, but the corresponding tuple struct has 0 fields
Z1(_, _) => {} //~ ERROR this pattern has 2 fields, but the corresponding tuple struct has 0 fields
}
match E1::Z0 {
E1::Z0 => {}
E1::Z0() => {} //~ ERROR expected tuple struct or tuple variant, found unit variant `E1::Z0`
E1::Z0(_) => {} //~ ERROR expected tuple struct or tuple variant, found unit variant `E1::Z0`
E1::Z0(_, _) => {} //~ ERROR expected tuple struct or tuple variant, found unit variant `E1::Z0`
}
match E1::Z1() {
E1::Z1 => {} //~ ERROR expected unit struct, unit variant or constant, found tuple variant `E1::Z1`
E1::Z1() => {}
E1::Z1(_) => {} //~ ERROR this pattern has 1 field, but the corresponding tuple variant has 0 fields
E1::Z1(_, _) => {} //~ ERROR this pattern has 2 fields, but the corresponding tuple variant has 0 fields
}
}
|