]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
Rollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow...
[rust.git] / tests / ui / type-alias-enum-variants / enum-variant-generic-args.stderr
1 error[E0308]: mismatched types
2   --> $DIR/enum-variant-generic-args.rs:13:25
3    |
4 LL | impl<T> Enum<T> {
5    |      - this type parameter
6 LL |     fn ts_variant() {
7 LL |         Self::TSVariant(());
8    |         --------------- ^^ expected type parameter `T`, found `()`
9    |         |
10    |         arguments to this enum variant are incorrect
11    |
12    = note: expected type parameter `T`
13                    found unit type `()`
14 note: tuple variant defined here
15   --> $DIR/enum-variant-generic-args.rs:7:16
16    |
17 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
18    |                ^^^^^^^^^
19
20 error[E0109]: type arguments are not allowed on this type
21   --> $DIR/enum-variant-generic-args.rs:15:27
22    |
23 LL |         Self::TSVariant::<()>(());
24    |               ---------   ^^ type argument not allowed
25    |               |
26    |               not allowed on this type
27
28 error[E0109]: type arguments are not allowed on self type
29   --> $DIR/enum-variant-generic-args.rs:17:16
30    |
31 LL |         Self::<()>::TSVariant(());
32    |         ----   ^^ type argument not allowed
33    |         |
34    |         not allowed on self type
35    |
36 note: `Self` is of type `Enum<T>`
37   --> $DIR/enum-variant-generic-args.rs:7:6
38    |
39 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
40    |      ^^^^ `Self` corresponds to this type
41 ...
42 LL | impl<T> Enum<T> {
43    | --------------- `Self` is on type `Enum` in this `impl`
44 help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters
45    |
46 LL |         Enum::<()>::TSVariant(());
47    |         ~~~~
48
49 error[E0308]: mismatched types
50   --> $DIR/enum-variant-generic-args.rs:17:31
51    |
52 LL | impl<T> Enum<T> {
53    |      - this type parameter
54 ...
55 LL |         Self::<()>::TSVariant(());
56    |         --------------------- ^^ expected type parameter `T`, found `()`
57    |         |
58    |         arguments to this enum variant are incorrect
59    |
60    = note: expected type parameter `T`
61                    found unit type `()`
62 note: tuple variant defined here
63   --> $DIR/enum-variant-generic-args.rs:7:16
64    |
65 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
66    |                ^^^^^^^^^
67
68 error[E0109]: type arguments are not allowed on self type
69   --> $DIR/enum-variant-generic-args.rs:20:16
70    |
71 LL |         Self::<()>::TSVariant::<()>(());
72    |         ----   ^^ type argument not allowed
73    |         |
74    |         not allowed on self type
75    |
76 note: `Self` is of type `Enum<T>`
77   --> $DIR/enum-variant-generic-args.rs:7:6
78    |
79 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
80    |      ^^^^ `Self` corresponds to this type
81 ...
82 LL | impl<T> Enum<T> {
83    | --------------- `Self` is on type `Enum` in this `impl`
84 help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters
85    |
86 LL |         Enum::<()>::TSVariant::<()>(());
87    |         ~~~~
88
89 error[E0109]: type arguments are not allowed on this type
90   --> $DIR/enum-variant-generic-args.rs:20:33
91    |
92 LL |         Self::<()>::TSVariant::<()>(());
93    |                     ---------   ^^ type argument not allowed
94    |                     |
95    |                     not allowed on this type
96
97 error[E0308]: mismatched types
98   --> $DIR/enum-variant-generic-args.rs:26:29
99    |
100 LL | impl<T> Enum<T> {
101    |      - this type parameter
102 ...
103 LL |         Self::SVariant { v: () };
104    |                             ^^ expected type parameter `T`, found `()`
105    |
106    = note: expected type parameter `T`
107                    found unit type `()`
108
109 error[E0109]: type arguments are not allowed on this type
110   --> $DIR/enum-variant-generic-args.rs:28:26
111    |
112 LL |         Self::SVariant::<()> { v: () };
113    |               --------   ^^ type argument not allowed
114    |               |
115    |               not allowed on this type
116    |
117    = note: enum variants can't have type parameters
118 help: you might have meant to specity type parameters on enum `Enum`
119    |
120 LL -         Self::SVariant::<()> { v: () };
121 LL +         Enum::<()>::SVariant { v: () };
122    |
123
124 error[E0308]: mismatched types
125   --> $DIR/enum-variant-generic-args.rs:28:35
126    |
127 LL | impl<T> Enum<T> {
128    |      - this type parameter
129 ...
130 LL |         Self::SVariant::<()> { v: () };
131    |                                   ^^ expected type parameter `T`, found `()`
132    |
133    = note: expected type parameter `T`
134                    found unit type `()`
135
136 error[E0109]: type arguments are not allowed on self type
137   --> $DIR/enum-variant-generic-args.rs:31:16
138    |
139 LL |         Self::<()>::SVariant { v: () };
140    |         ----   ^^ type argument not allowed
141    |         |
142    |         not allowed on self type
143    |
144 note: `Self` is of type `Enum<T>`
145   --> $DIR/enum-variant-generic-args.rs:7:6
146    |
147 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
148    |      ^^^^ `Self` corresponds to this type
149 ...
150 LL | impl<T> Enum<T> {
151    | --------------- `Self` is on type `Enum` in this `impl`
152 help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters
153    |
154 LL |         Enum::<()>::SVariant { v: () };
155    |         ~~~~
156
157 error[E0308]: mismatched types
158   --> $DIR/enum-variant-generic-args.rs:31:35
159    |
160 LL | impl<T> Enum<T> {
161    |      - this type parameter
162 ...
163 LL |         Self::<()>::SVariant { v: () };
164    |                                   ^^ expected type parameter `T`, found `()`
165    |
166    = note: expected type parameter `T`
167                    found unit type `()`
168
169 error[E0109]: type arguments are not allowed on self type
170   --> $DIR/enum-variant-generic-args.rs:34:16
171    |
172 LL |         Self::<()>::SVariant::<()> { v: () };
173    |         ----   ^^ type argument not allowed
174    |         |
175    |         not allowed on self type
176    |
177 note: `Self` is of type `Enum<T>`
178   --> $DIR/enum-variant-generic-args.rs:7:6
179    |
180 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
181    |      ^^^^ `Self` corresponds to this type
182 ...
183 LL | impl<T> Enum<T> {
184    | --------------- `Self` is on type `Enum` in this `impl`
185 help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters
186    |
187 LL |         Enum::<()>::SVariant::<()> { v: () };
188    |         ~~~~
189
190 error[E0109]: type arguments are not allowed on this type
191   --> $DIR/enum-variant-generic-args.rs:34:32
192    |
193 LL |         Self::<()>::SVariant::<()> { v: () };
194    |                     --------   ^^ type argument not allowed
195    |                     |
196    |                     not allowed on this type
197    |
198    = note: enum variants can't have type parameters
199 help: you might have meant to specity type parameters on enum `Enum`
200    |
201 LL -         Self::<()>::SVariant::<()> { v: () };
202 LL +         Enum::<()>::SVariant { v: () };
203    |
204
205 error[E0308]: mismatched types
206   --> $DIR/enum-variant-generic-args.rs:34:41
207    |
208 LL | impl<T> Enum<T> {
209    |      - this type parameter
210 ...
211 LL |         Self::<()>::SVariant::<()> { v: () };
212    |                                         ^^ expected type parameter `T`, found `()`
213    |
214    = note: expected type parameter `T`
215                    found unit type `()`
216
217 error[E0109]: type arguments are not allowed on this type
218   --> $DIR/enum-variant-generic-args.rs:41:26
219    |
220 LL |         Self::UVariant::<()>;
221    |               --------   ^^ type argument not allowed
222    |               |
223    |               not allowed on this type
224
225 error[E0109]: type arguments are not allowed on self type
226   --> $DIR/enum-variant-generic-args.rs:43:16
227    |
228 LL |         Self::<()>::UVariant;
229    |         ----   ^^ type argument not allowed
230    |         |
231    |         not allowed on self type
232    |
233 note: `Self` is of type `Enum<T>`
234   --> $DIR/enum-variant-generic-args.rs:7:6
235    |
236 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
237    |      ^^^^ `Self` corresponds to this type
238 ...
239 LL | impl<T> Enum<T> {
240    | --------------- `Self` is on type `Enum` in this `impl`
241 help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters
242    |
243 LL |         Enum::<()>::UVariant;
244    |         ~~~~
245
246 error[E0109]: type arguments are not allowed on self type
247   --> $DIR/enum-variant-generic-args.rs:45:16
248    |
249 LL |         Self::<()>::UVariant::<()>;
250    |         ----   ^^ type argument not allowed
251    |         |
252    |         not allowed on self type
253    |
254 note: `Self` is of type `Enum<T>`
255   --> $DIR/enum-variant-generic-args.rs:7:6
256    |
257 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
258    |      ^^^^ `Self` corresponds to this type
259 ...
260 LL | impl<T> Enum<T> {
261    | --------------- `Self` is on type `Enum` in this `impl`
262 help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters
263    |
264 LL |         Enum::<()>::UVariant::<()>;
265    |         ~~~~
266
267 error[E0109]: type arguments are not allowed on this type
268   --> $DIR/enum-variant-generic-args.rs:45:32
269    |
270 LL |         Self::<()>::UVariant::<()>;
271    |                     --------   ^^ type argument not allowed
272    |                     |
273    |                     not allowed on this type
274
275 error[E0109]: type arguments are not allowed on tuple variant `TSVariant`
276   --> $DIR/enum-variant-generic-args.rs:54:29
277    |
278 LL |     Enum::<()>::TSVariant::<()>(());
279    |                 ---------   ^^ type argument not allowed
280    |                 |
281    |                 not allowed on tuple variant `TSVariant`
282
283 error[E0109]: type arguments are not allowed on this type
284   --> $DIR/enum-variant-generic-args.rs:57:24
285    |
286 LL |     Alias::TSVariant::<()>(());
287    |            ---------   ^^ type argument not allowed
288    |            |
289    |            not allowed on this type
290
291 error[E0109]: type arguments are not allowed on this type
292   --> $DIR/enum-variant-generic-args.rs:59:30
293    |
294 LL |     Alias::<()>::TSVariant::<()>(());
295    |                  ---------   ^^ type argument not allowed
296    |                  |
297    |                  not allowed on this type
298
299 error[E0109]: type arguments are not allowed on this type
300   --> $DIR/enum-variant-generic-args.rs:62:29
301    |
302 LL |     AliasFixed::TSVariant::<()>(());
303    |                 ---------   ^^ type argument not allowed
304    |                 |
305    |                 not allowed on this type
306
307 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
308   --> $DIR/enum-variant-generic-args.rs:64:5
309    |
310 LL |     AliasFixed::<()>::TSVariant(());
311    |     ^^^^^^^^^^------ help: remove these generics
312    |     |
313    |     expected 0 generic arguments
314    |
315 note: type alias defined here, with 0 generic parameters
316   --> $DIR/enum-variant-generic-args.rs:9:6
317    |
318 LL | type AliasFixed = Enum<()>;
319    |      ^^^^^^^^^^
320
321 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
322   --> $DIR/enum-variant-generic-args.rs:66:5
323    |
324 LL |     AliasFixed::<()>::TSVariant::<()>(());
325    |     ^^^^^^^^^^------ help: remove these generics
326    |     |
327    |     expected 0 generic arguments
328    |
329 note: type alias defined here, with 0 generic parameters
330   --> $DIR/enum-variant-generic-args.rs:9:6
331    |
332 LL | type AliasFixed = Enum<()>;
333    |      ^^^^^^^^^^
334
335 error[E0109]: type arguments are not allowed on this type
336   --> $DIR/enum-variant-generic-args.rs:66:35
337    |
338 LL |     AliasFixed::<()>::TSVariant::<()>(());
339    |                       ---------   ^^ type argument not allowed
340    |                       |
341    |                       not allowed on this type
342
343 error[E0109]: type arguments are not allowed on variant `SVariant`
344   --> $DIR/enum-variant-generic-args.rs:72:28
345    |
346 LL |     Enum::<()>::SVariant::<()> { v: () };
347    |                 --------   ^^ type argument not allowed
348    |                 |
349    |                 not allowed on variant `SVariant`
350    |
351    = note: enum variants can't have type parameters
352
353 error[E0109]: type arguments are not allowed on this type
354   --> $DIR/enum-variant-generic-args.rs:75:23
355    |
356 LL |     Alias::SVariant::<()> { v: () };
357    |            --------   ^^ type argument not allowed
358    |            |
359    |            not allowed on this type
360    |
361    = note: enum variants can't have type parameters
362 help: you might have meant to specity type parameters on enum `Enum`
363    |
364 LL -     Alias::SVariant::<()> { v: () };
365 LL +     Alias::<()>::SVariant { v: () };
366    |
367
368 error[E0109]: type arguments are not allowed on this type
369   --> $DIR/enum-variant-generic-args.rs:77:29
370    |
371 LL |     Alias::<()>::SVariant::<()> { v: () };
372    |                  --------   ^^ type argument not allowed
373    |                  |
374    |                  not allowed on this type
375    |
376    = note: enum variants can't have type parameters
377 help: you might have meant to specity type parameters on enum `Enum`
378    |
379 LL -     Alias::<()>::SVariant::<()> { v: () };
380 LL +     Alias::<()>::SVariant { v: () };
381    |
382
383 error[E0109]: type arguments are not allowed on this type
384   --> $DIR/enum-variant-generic-args.rs:80:28
385    |
386 LL |     AliasFixed::SVariant::<()> { v: () };
387    |                 --------   ^^ type argument not allowed
388    |                 |
389    |                 not allowed on this type
390    |
391    = note: enum variants can't have type parameters
392 help: you might have meant to specity type parameters on enum `Enum`
393    |
394 LL -     AliasFixed::SVariant::<()> { v: () };
395 LL +     AliasFixed::<()>::SVariant { v: () };
396    |
397
398 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
399   --> $DIR/enum-variant-generic-args.rs:82:5
400    |
401 LL |     AliasFixed::<()>::SVariant { v: () };
402    |     ^^^^^^^^^^------ help: remove these generics
403    |     |
404    |     expected 0 generic arguments
405    |
406 note: type alias defined here, with 0 generic parameters
407   --> $DIR/enum-variant-generic-args.rs:9:6
408    |
409 LL | type AliasFixed = Enum<()>;
410    |      ^^^^^^^^^^
411
412 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
413   --> $DIR/enum-variant-generic-args.rs:84:5
414    |
415 LL |     AliasFixed::<()>::SVariant::<()> { v: () };
416    |     ^^^^^^^^^^------ help: remove these generics
417    |     |
418    |     expected 0 generic arguments
419    |
420 note: type alias defined here, with 0 generic parameters
421   --> $DIR/enum-variant-generic-args.rs:9:6
422    |
423 LL | type AliasFixed = Enum<()>;
424    |      ^^^^^^^^^^
425
426 error[E0109]: type arguments are not allowed on this type
427   --> $DIR/enum-variant-generic-args.rs:84:34
428    |
429 LL |     AliasFixed::<()>::SVariant::<()> { v: () };
430    |                       --------   ^^ type argument not allowed
431    |                       |
432    |                       not allowed on this type
433    |
434    = note: enum variants can't have type parameters
435 help: you might have meant to specity type parameters on enum `Enum`
436    |
437 LL -     AliasFixed::<()>::SVariant::<()> { v: () };
438 LL +     AliasFixed::<()>::SVariant { v: () };
439    |
440
441 error[E0109]: type arguments are not allowed on unit variant `UVariant`
442   --> $DIR/enum-variant-generic-args.rs:90:28
443    |
444 LL |     Enum::<()>::UVariant::<()>;
445    |                 --------   ^^ type argument not allowed
446    |                 |
447    |                 not allowed on unit variant `UVariant`
448
449 error[E0109]: type arguments are not allowed on this type
450   --> $DIR/enum-variant-generic-args.rs:93:23
451    |
452 LL |     Alias::UVariant::<()>;
453    |            --------   ^^ type argument not allowed
454    |            |
455    |            not allowed on this type
456
457 error[E0109]: type arguments are not allowed on this type
458   --> $DIR/enum-variant-generic-args.rs:95:29
459    |
460 LL |     Alias::<()>::UVariant::<()>;
461    |                  --------   ^^ type argument not allowed
462    |                  |
463    |                  not allowed on this type
464
465 error[E0109]: type arguments are not allowed on this type
466   --> $DIR/enum-variant-generic-args.rs:98:28
467    |
468 LL |     AliasFixed::UVariant::<()>;
469    |                 --------   ^^ type argument not allowed
470    |                 |
471    |                 not allowed on this type
472
473 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
474   --> $DIR/enum-variant-generic-args.rs:100:5
475    |
476 LL |     AliasFixed::<()>::UVariant;
477    |     ^^^^^^^^^^------ help: remove these generics
478    |     |
479    |     expected 0 generic arguments
480    |
481 note: type alias defined here, with 0 generic parameters
482   --> $DIR/enum-variant-generic-args.rs:9:6
483    |
484 LL | type AliasFixed = Enum<()>;
485    |      ^^^^^^^^^^
486
487 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
488   --> $DIR/enum-variant-generic-args.rs:102:5
489    |
490 LL |     AliasFixed::<()>::UVariant::<()>;
491    |     ^^^^^^^^^^------ help: remove these generics
492    |     |
493    |     expected 0 generic arguments
494    |
495 note: type alias defined here, with 0 generic parameters
496   --> $DIR/enum-variant-generic-args.rs:9:6
497    |
498 LL | type AliasFixed = Enum<()>;
499    |      ^^^^^^^^^^
500
501 error[E0109]: type arguments are not allowed on this type
502   --> $DIR/enum-variant-generic-args.rs:102:34
503    |
504 LL |     AliasFixed::<()>::UVariant::<()>;
505    |                       --------   ^^ type argument not allowed
506    |                       |
507    |                       not allowed on this type
508
509 error: aborting due to 39 previous errors
510
511 Some errors have detailed explanations: E0107, E0109, E0308.
512 For more information about an error, try `rustc --explain E0107`.