1+ error[E0530]: match bindings cannot shadow tuple structs
2+ --> $DIR/pat-tuple-overfield.rs:43:9
3+ |
4+ LL | struct Z1();
5+ | ------------ the tuple struct `Z1` is defined here
6+ ...
7+ LL | Z1 => {}
8+ | ^^ cannot be named the same as a tuple struct
9+
10+ error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
11+ --> $DIR/pat-tuple-overfield.rs:38:9
12+ |
13+ LL | struct Z0;
14+ | ---------- `Z0` defined here
15+ LL | struct Z1();
16+ | ------------ similarly named tuple struct `Z1` defined here
17+ ...
18+ LL | Z0() => {}
19+ | ^^^^
20+ |
21+ help: use this syntax instead
22+ |
23+ LL | Z0 => {}
24+ | ~~
25+ help: a tuple struct with a similar name exists
26+ |
27+ LL | Z1() => {}
28+ | ~~
29+
30+ error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
31+ --> $DIR/pat-tuple-overfield.rs:39:9
32+ |
33+ LL | struct Z0;
34+ | ---------- `Z0` defined here
35+ LL | struct Z1();
36+ | ------------ similarly named tuple struct `Z1` defined here
37+ ...
38+ LL | Z0(_) => {}
39+ | ^^^^^
40+ |
41+ help: use this syntax instead
42+ |
43+ LL | Z0 => {}
44+ | ~~
45+ help: a tuple struct with a similar name exists
46+ |
47+ LL | Z1(_) => {}
48+ | ~~
49+
50+ error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
51+ --> $DIR/pat-tuple-overfield.rs:40:9
52+ |
53+ LL | struct Z0;
54+ | ---------- `Z0` defined here
55+ LL | struct Z1();
56+ | ------------ similarly named tuple struct `Z1` defined here
57+ ...
58+ LL | Z0(_, _) => {}
59+ | ^^^^^^^^
60+ |
61+ help: use this syntax instead
62+ |
63+ LL | Z0 => {}
64+ | ~~
65+ help: a tuple struct with a similar name exists
66+ |
67+ LL | Z1(_, _) => {}
68+ | ~~
69+
70+ error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0`
71+ --> $DIR/pat-tuple-overfield.rs:50:9
72+ |
73+ LL | Z0,
74+ | -- `E1::Z0` defined here
75+ LL | Z1(),
76+ | ---- similarly named tuple variant `Z1` defined here
77+ ...
78+ LL | E1::Z0() => {}
79+ | ^^^^^^^^
80+ |
81+ help: use this syntax instead
82+ |
83+ LL | E1::Z0 => {}
84+ | ~~~~~~
85+ help: a tuple variant with a similar name exists
86+ |
87+ LL | E1::Z1() => {}
88+ | ~~
89+
90+ error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0`
91+ --> $DIR/pat-tuple-overfield.rs:51:9
92+ |
93+ LL | Z0,
94+ | -- `E1::Z0` defined here
95+ LL | Z1(),
96+ | ---- similarly named tuple variant `Z1` defined here
97+ ...
98+ LL | E1::Z0(_) => {}
99+ | ^^^^^^^^^
100+ |
101+ help: use this syntax instead
102+ |
103+ LL | E1::Z0 => {}
104+ | ~~~~~~
105+ help: a tuple variant with a similar name exists
106+ |
107+ LL | E1::Z1(_) => {}
108+ | ~~
109+
110+ error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0`
111+ --> $DIR/pat-tuple-overfield.rs:52:9
112+ |
113+ LL | Z0,
114+ | -- `E1::Z0` defined here
115+ LL | Z1(),
116+ | ---- similarly named tuple variant `Z1` defined here
117+ ...
118+ LL | E1::Z0(_, _) => {}
119+ | ^^^^^^^^^^^^
120+ |
121+ help: use this syntax instead
122+ |
123+ LL | E1::Z0 => {}
124+ | ~~~~~~
125+ help: a tuple variant with a similar name exists
126+ |
127+ LL | E1::Z1(_, _) => {}
128+ | ~~
129+
130+ error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E1::Z1`
131+ --> $DIR/pat-tuple-overfield.rs:55:9
132+ |
133+ LL | Z0,
134+ | -- similarly named unit variant `Z0` defined here
135+ LL | Z1(),
136+ | ---- `E1::Z1` defined here
137+ ...
138+ LL | E1::Z1 => {}
139+ | ^^^^^^
140+ |
141+ help: use the tuple variant pattern syntax instead
142+ |
143+ LL | E1::Z1() => {}
144+ | ~~~~~~~~
145+ help: a unit variant with a similar name exists
146+ |
147+ LL | E1::Z0 => {}
148+ | ~~
149+
1150error[E0308]: mismatched types
2- --> $DIR/pat-tuple-overfield.rs:5 :9
151+ --> $DIR/pat-tuple-overfield.rs:21 :9
3152 |
4153LL | match (1, 2, 3) {
5154 | --------- this expression has type `({integer}, {integer}, {integer})`
@@ -10,7 +159,7 @@ LL | (1, 2, 3, 4) => {}
10159 found tuple `(_, _, _, _)`
11160
12161error[E0308]: mismatched types
13- --> $DIR/pat-tuple-overfield.rs:6 :9
162+ --> $DIR/pat-tuple-overfield.rs:22 :9
14163 |
15164LL | match (1, 2, 3) {
16165 | --------- this expression has type `({integer}, {integer}, {integer})`
@@ -22,7 +171,7 @@ LL | (1, 2, .., 3, 4) => {}
22171 found tuple `(_, _, _, _)`
23172
24173error[E0023]: this pattern has 4 fields, but the corresponding tuple struct has 3 fields
25- --> $DIR/pat-tuple-overfield.rs:10 :10
174+ --> $DIR/pat-tuple-overfield.rs:26 :10
26175 |
27176LL | struct S(u8, u8, u8);
28177 | --------------------- tuple struct defined here
@@ -33,7 +182,7 @@ LL | S(1, 2, 3, 4) => {}
33182 | this tuple struct
34183
35184error[E0023]: this pattern has 4 fields, but the corresponding tuple struct has 3 fields
36- --> $DIR/pat-tuple-overfield.rs:12 :10
185+ --> $DIR/pat-tuple-overfield.rs:28 :10
37186 |
38187LL | struct S(u8, u8, u8);
39188 | --------------------- tuple struct defined here
@@ -43,7 +192,68 @@ LL | S(1, 2, .., 3, 4) => {}
43192 | |
44193 | this tuple struct
45194
46- error: aborting due to 4 previous errors
195+ error[E0023]: this pattern has 6 fields, but the corresponding tuple struct has 5 fields
196+ --> $DIR/pat-tuple-overfield.rs:33:10
197+ |
198+ LL | / struct M(
199+ LL | | u8,
200+ LL | | u8,
201+ LL | | u8,
202+ LL | | u8,
203+ LL | | u8,
204+ LL | | );
205+ | |__- tuple struct defined here
206+ ...
207+ LL | M(1, 2, 3, 4, 5, 6) => {}
208+ | -^^^^^^^^^^^^^^^^^^ expected 5 fields, found 6
209+ | |
210+ | this tuple struct
211+
212+ error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 0 fields
213+ --> $DIR/pat-tuple-overfield.rs:45:11
214+ |
215+ LL | struct Z1();
216+ | ------------ tuple struct defined here
217+ ...
218+ LL | Z1(_) => {}
219+ | --^^^ expected 0 fields, found 1
220+ | |
221+ | this tuple struct
222+
223+ error[E0023]: this pattern has 2 fields, but the corresponding tuple struct has 0 fields
224+ --> $DIR/pat-tuple-overfield.rs:46:11
225+ |
226+ LL | struct Z1();
227+ | ------------ tuple struct defined here
228+ ...
229+ LL | Z1(_, _) => {}
230+ | --^^^^^^ expected 0 fields, found 2
231+ | |
232+ | this tuple struct
233+
234+ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 0 fields
235+ --> $DIR/pat-tuple-overfield.rs:57:15
236+ |
237+ LL | Z1(),
238+ | ---- tuple variant defined here
239+ ...
240+ LL | E1::Z1(_) => {}
241+ | ------^^^ expected 0 fields, found 1
242+ | |
243+ | this tuple variant
244+
245+ error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 0 fields
246+ --> $DIR/pat-tuple-overfield.rs:58:15
247+ |
248+ LL | Z1(),
249+ | ---- tuple variant defined here
250+ ...
251+ LL | E1::Z1(_, _) => {}
252+ | ------^^^^^^ expected 0 fields, found 2
253+ | |
254+ | this tuple variant
255+
256+ error: aborting due to 17 previous errors
47257
48- Some errors have detailed explanations: E0023, E0308.
258+ Some errors have detailed explanations: E0023, E0308, E0530, E0532 .
49259For more information about an error, try `rustc --explain E0023`.
0 commit comments