]> git.lizzy.rs Git - rust.git/blob - src/test/ui/typeck/typeck_type_placeholder_item.stderr
Fixing bad suggestion for `_` in `const` type when a function #81885
[rust.git] / src / test / ui / typeck / typeck_type_placeholder_item.stderr
1 error: expected identifier, found reserved identifier `_`
2   --> $DIR/typeck_type_placeholder_item.rs:154:18
3    |
4 LL | struct BadStruct<_>(_);
5    |                  ^ expected identifier, found reserved identifier
6
7 error: expected identifier, found reserved identifier `_`
8   --> $DIR/typeck_type_placeholder_item.rs:157:16
9    |
10 LL | trait BadTrait<_> {}
11    |                ^ expected identifier, found reserved identifier
12
13 error: expected identifier, found reserved identifier `_`
14   --> $DIR/typeck_type_placeholder_item.rs:167:19
15    |
16 LL | struct BadStruct1<_, _>(_);
17    |                   ^ expected identifier, found reserved identifier
18
19 error: expected identifier, found reserved identifier `_`
20   --> $DIR/typeck_type_placeholder_item.rs:167:22
21    |
22 LL | struct BadStruct1<_, _>(_);
23    |                      ^ expected identifier, found reserved identifier
24
25 error: expected identifier, found reserved identifier `_`
26   --> $DIR/typeck_type_placeholder_item.rs:172:19
27    |
28 LL | struct BadStruct2<_, T>(_, T);
29    |                   ^ expected identifier, found reserved identifier
30
31 error: associated constant in `impl` without body
32   --> $DIR/typeck_type_placeholder_item.rs:205:5
33    |
34 LL |     const C: _;
35    |     ^^^^^^^^^^-
36    |               |
37    |               help: provide a definition for the constant: `= <expr>;`
38
39 error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters
40   --> $DIR/typeck_type_placeholder_item.rs:167:22
41    |
42 LL | struct BadStruct1<_, _>(_);
43    |                   -  ^ already used
44    |                   |
45    |                   first use of `_`
46
47 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
48   --> $DIR/typeck_type_placeholder_item.rs:6:14
49    |
50 LL | fn test() -> _ { 5 }
51    |              ^
52    |              |
53    |              not allowed in type signatures
54    |              help: replace with the correct return type: `i32`
55
56 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
57   --> $DIR/typeck_type_placeholder_item.rs:9:16
58    |
59 LL | fn test2() -> (_, _) { (5, 5) }
60    |               -^--^-
61    |               ||  |
62    |               ||  not allowed in type signatures
63    |               |not allowed in type signatures
64    |               help: replace with the correct return type: `(i32, i32)`
65
66 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
67   --> $DIR/typeck_type_placeholder_item.rs:12:15
68    |
69 LL | static TEST3: _ = "test";
70    |               ^
71    |               |
72    |               not allowed in type signatures
73    |               help: replace `_` with the correct type: `&str`
74
75 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
76   --> $DIR/typeck_type_placeholder_item.rs:15:15
77    |
78 LL | static TEST4: _ = 145;
79    |               ^
80    |               |
81    |               not allowed in type signatures
82    |               help: replace `_` with the correct type: `i32`
83
84 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
85   --> $DIR/typeck_type_placeholder_item.rs:18:15
86    |
87 LL | static TEST5: (_, _) = (1, 2);
88    |               ^^^^^^ not allowed in type signatures
89
90 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
91   --> $DIR/typeck_type_placeholder_item.rs:21:13
92    |
93 LL | fn test6(_: _) { }
94    |             ^ not allowed in type signatures
95
96 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
97   --> $DIR/typeck_type_placeholder_item.rs:24:18
98    |
99 LL | fn test6_b<T>(_: _, _: T) { }
100    |                  ^ not allowed in type signatures
101
102 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
103   --> $DIR/typeck_type_placeholder_item.rs:27:30
104    |
105 LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
106    |                              ^ not allowed in type signatures
107
108 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
109   --> $DIR/typeck_type_placeholder_item.rs:30:13
110    |
111 LL | fn test7(x: _) { let _x: usize = x; }
112    |             ^ not allowed in type signatures
113
114 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
115   --> $DIR/typeck_type_placeholder_item.rs:33:22
116    |
117 LL | fn test8(_f: fn() -> _) { }
118    |                      ^ not allowed in type signatures
119
120 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
121   --> $DIR/typeck_type_placeholder_item.rs:33:22
122    |
123 LL | fn test8(_f: fn() -> _) { }
124    |                      ^ not allowed in type signatures
125
126 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
127   --> $DIR/typeck_type_placeholder_item.rs:47:26
128    |
129 LL | fn test11(x: &usize) -> &_ {
130    |                         -^
131    |                         ||
132    |                         |not allowed in type signatures
133    |                         help: replace with the correct return type: `&&usize`
134
135 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
136   --> $DIR/typeck_type_placeholder_item.rs:52:52
137    |
138 LL | unsafe fn test12(x: *const usize) -> *const *const _ {
139    |                                      --------------^
140    |                                      |             |
141    |                                      |             not allowed in type signatures
142    |                                      help: replace with the correct return type: `*const *const usize`
143
144 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
145   --> $DIR/typeck_type_placeholder_item.rs:66:8
146    |
147 LL |     a: _,
148    |        ^ not allowed in type signatures
149 LL |
150 LL |     b: (_, _),
151    |         ^  ^ not allowed in type signatures
152    |         |
153    |         not allowed in type signatures
154    |
155 help: use type parameters instead
156    |
157 LL | struct Test10<T> {
158 LL |     a: T,
159 LL |
160 LL |     b: (T, T),
161    |
162
163 error: missing type for `static` item
164   --> $DIR/typeck_type_placeholder_item.rs:72:12
165    |
166 LL |     static A = 42;
167    |            ^ help: provide a type for the item: `A: i32`
168
169 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
170   --> $DIR/typeck_type_placeholder_item.rs:74:15
171    |
172 LL |     static B: _ = 42;
173    |               ^
174    |               |
175    |               not allowed in type signatures
176    |               help: replace `_` with the correct type: `i32`
177
178 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
179   --> $DIR/typeck_type_placeholder_item.rs:76:15
180    |
181 LL |     static C: Option<_> = Some(42);
182    |               ^^^^^^^^^ not allowed in type signatures
183
184 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
185   --> $DIR/typeck_type_placeholder_item.rs:79:21
186    |
187 LL |     fn fn_test() -> _ { 5 }
188    |                     ^
189    |                     |
190    |                     not allowed in type signatures
191    |                     help: replace with the correct return type: `i32`
192
193 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
194   --> $DIR/typeck_type_placeholder_item.rs:82:23
195    |
196 LL |     fn fn_test2() -> (_, _) { (5, 5) }
197    |                      -^--^-
198    |                      ||  |
199    |                      ||  not allowed in type signatures
200    |                      |not allowed in type signatures
201    |                      help: replace with the correct return type: `(i32, i32)`
202
203 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
204   --> $DIR/typeck_type_placeholder_item.rs:85:22
205    |
206 LL |     static FN_TEST3: _ = "test";
207    |                      ^
208    |                      |
209    |                      not allowed in type signatures
210    |                      help: replace `_` with the correct type: `&str`
211
212 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
213   --> $DIR/typeck_type_placeholder_item.rs:88:22
214    |
215 LL |     static FN_TEST4: _ = 145;
216    |                      ^
217    |                      |
218    |                      not allowed in type signatures
219    |                      help: replace `_` with the correct type: `i32`
220
221 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
222   --> $DIR/typeck_type_placeholder_item.rs:91:22
223    |
224 LL |     static FN_TEST5: (_, _) = (1, 2);
225    |                      ^^^^^^ not allowed in type signatures
226
227 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
228   --> $DIR/typeck_type_placeholder_item.rs:94:20
229    |
230 LL |     fn fn_test6(_: _) { }
231    |                    ^ not allowed in type signatures
232
233 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
234   --> $DIR/typeck_type_placeholder_item.rs:97:20
235    |
236 LL |     fn fn_test7(x: _) { let _x: usize = x; }
237    |                    ^ not allowed in type signatures
238
239 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
240   --> $DIR/typeck_type_placeholder_item.rs:100:29
241    |
242 LL |     fn fn_test8(_f: fn() -> _) { }
243    |                             ^ not allowed in type signatures
244
245 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
246   --> $DIR/typeck_type_placeholder_item.rs:100:29
247    |
248 LL |     fn fn_test8(_f: fn() -> _) { }
249    |                             ^ not allowed in type signatures
250
251 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
252   --> $DIR/typeck_type_placeholder_item.rs:123:12
253    |
254 LL |         a: _,
255    |            ^ not allowed in type signatures
256 LL |
257 LL |         b: (_, _),
258    |             ^  ^ not allowed in type signatures
259    |             |
260    |             not allowed in type signatures
261    |
262 help: use type parameters instead
263    |
264 LL |     struct FnTest10<T> {
265 LL |         a: T,
266 LL |
267 LL |         b: (T, T),
268    |
269
270 error[E0282]: type annotations needed
271   --> $DIR/typeck_type_placeholder_item.rs:128:18
272    |
273 LL |     fn fn_test11(_: _) -> (_, _) { panic!() }
274    |                  ^ cannot infer type
275
276 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
277   --> $DIR/typeck_type_placeholder_item.rs:128:28
278    |
279 LL |     fn fn_test11(_: _) -> (_, _) { panic!() }
280    |                            ^  ^ not allowed in type signatures
281    |                            |
282    |                            not allowed in type signatures
283
284 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
285   --> $DIR/typeck_type_placeholder_item.rs:132:30
286    |
287 LL |     fn fn_test12(x: i32) -> (_, _) { (x, x) }
288    |                             -^--^-
289    |                             ||  |
290    |                             ||  not allowed in type signatures
291    |                             |not allowed in type signatures
292    |                             help: replace with the correct return type: `(i32, i32)`
293
294 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
295   --> $DIR/typeck_type_placeholder_item.rs:135:33
296    |
297 LL |     fn fn_test13(x: _) -> (i32, _) { (x, x) }
298    |                           ------^-
299    |                           |     |
300    |                           |     not allowed in type signatures
301    |                           help: replace with the correct return type: `(i32, i32)`
302
303 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
304   --> $DIR/typeck_type_placeholder_item.rs:154:21
305    |
306 LL | struct BadStruct<_>(_);
307    |                     ^ not allowed in type signatures
308    |
309 help: use type parameters instead
310    |
311 LL | struct BadStruct<T>(T);
312    |                  ^  ^
313
314 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
315   --> $DIR/typeck_type_placeholder_item.rs:159:15
316    |
317 LL | impl BadTrait<_> for BadStruct<_> {}
318    |               ^                ^ not allowed in type signatures
319    |               |
320    |               not allowed in type signatures
321    |
322 help: use type parameters instead
323    |
324 LL | impl<T> BadTrait<T> for BadStruct<T> {}
325    |     ^^^          ^                ^
326
327 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
328   --> $DIR/typeck_type_placeholder_item.rs:162:34
329    |
330 LL | fn impl_trait() -> impl BadTrait<_> {
331    |                                  ^ not allowed in type signatures
332
333 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
334   --> $DIR/typeck_type_placeholder_item.rs:167:25
335    |
336 LL | struct BadStruct1<_, _>(_);
337    |                         ^ not allowed in type signatures
338    |
339 help: use type parameters instead
340    |
341 LL | struct BadStruct1<T, _>(T);
342    |                   ^     ^
343
344 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
345   --> $DIR/typeck_type_placeholder_item.rs:172:25
346    |
347 LL | struct BadStruct2<_, T>(_, T);
348    |                         ^ not allowed in type signatures
349    |
350 help: use type parameters instead
351    |
352 LL | struct BadStruct2<U, T>(U, T);
353    |                   ^     ^
354
355 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
356   --> $DIR/typeck_type_placeholder_item.rs:176:14
357    |
358 LL | type X = Box<_>;
359    |              ^ not allowed in type signatures
360
361 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
362   --> $DIR/typeck_type_placeholder_item.rs:182:21
363    |
364 LL | type Y = impl Trait<_>;
365    |                     ^ not allowed in type signatures
366
367 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
368   --> $DIR/typeck_type_placeholder_item.rs:140:31
369    |
370 LL |     fn method_test1(&self, x: _);
371    |                               ^ not allowed in type signatures
372
373 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
374   --> $DIR/typeck_type_placeholder_item.rs:142:31
375    |
376 LL |     fn method_test2(&self, x: _) -> _;
377    |                               ^     ^ not allowed in type signatures
378    |                               |
379    |                               not allowed in type signatures
380
381 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
382   --> $DIR/typeck_type_placeholder_item.rs:144:31
383    |
384 LL |     fn method_test3(&self) -> _;
385    |                               ^ not allowed in type signatures
386
387 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
388   --> $DIR/typeck_type_placeholder_item.rs:146:26
389    |
390 LL |     fn assoc_fn_test1(x: _);
391    |                          ^ not allowed in type signatures
392
393 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
394   --> $DIR/typeck_type_placeholder_item.rs:148:26
395    |
396 LL |     fn assoc_fn_test2(x: _) -> _;
397    |                          ^     ^ not allowed in type signatures
398    |                          |
399    |                          not allowed in type signatures
400
401 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
402   --> $DIR/typeck_type_placeholder_item.rs:150:28
403    |
404 LL |     fn assoc_fn_test3() -> _;
405    |                            ^ not allowed in type signatures
406
407 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
408   --> $DIR/typeck_type_placeholder_item.rs:190:14
409    |
410 LL |     type B = _;
411    |              ^ not allowed in type signatures
412
413 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
414   --> $DIR/typeck_type_placeholder_item.rs:192:14
415    |
416 LL |     const C: _;
417    |              ^ not allowed in type signatures
418
419 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
420   --> $DIR/typeck_type_placeholder_item.rs:194:14
421    |
422 LL |     const D: _ = 42;
423    |              ^
424    |              |
425    |              not allowed in type signatures
426    |              help: replace `_` with the correct type: `i32`
427
428 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
429   --> $DIR/typeck_type_placeholder_item.rs:197:26
430    |
431 LL |     type F: std::ops::Fn(_);
432    |                          ^ not allowed in type signatures
433
434 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
435   --> $DIR/typeck_type_placeholder_item.rs:40:24
436    |
437 LL |     fn test9(&self) -> _ { () }
438    |                        ^
439    |                        |
440    |                        not allowed in type signatures
441    |                        help: replace with the correct return type: `()`
442
443 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
444   --> $DIR/typeck_type_placeholder_item.rs:43:27
445    |
446 LL |     fn test10(&self, _x : _) { }
447    |                           ^ not allowed in type signatures
448
449 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
450   --> $DIR/typeck_type_placeholder_item.rs:58:24
451    |
452 LL |     fn clone(&self) -> _ { Test9 }
453    |                        ^
454    |                        |
455    |                        not allowed in type signatures
456    |                        help: replace with the correct return type: `Test9`
457
458 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
459   --> $DIR/typeck_type_placeholder_item.rs:61:37
460    |
461 LL |     fn clone_from(&mut self, other: _) { *self = Test9; }
462    |                                     ^ not allowed in type signatures
463
464 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
465   --> $DIR/typeck_type_placeholder_item.rs:107:31
466    |
467 LL |         fn fn_test9(&self) -> _ { () }
468    |                               ^
469    |                               |
470    |                               not allowed in type signatures
471    |                               help: replace with the correct return type: `()`
472
473 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
474   --> $DIR/typeck_type_placeholder_item.rs:110:34
475    |
476 LL |         fn fn_test10(&self, _x : _) { }
477    |                                  ^ not allowed in type signatures
478
479 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
480   --> $DIR/typeck_type_placeholder_item.rs:115:28
481    |
482 LL |         fn clone(&self) -> _ { FnTest9 }
483    |                            ^
484    |                            |
485    |                            not allowed in type signatures
486    |                            help: replace with the correct return type: `FnTest9`
487
488 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
489   --> $DIR/typeck_type_placeholder_item.rs:118:41
490    |
491 LL |         fn clone_from(&mut self, other: _) { *self = FnTest9; }
492    |                                         ^ not allowed in type signatures
493
494 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
495   --> $DIR/typeck_type_placeholder_item.rs:201:14
496    |
497 LL |     type A = _;
498    |              ^ not allowed in type signatures
499
500 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
501   --> $DIR/typeck_type_placeholder_item.rs:203:14
502    |
503 LL |     type B = _;
504    |              ^ not allowed in type signatures
505
506 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
507   --> $DIR/typeck_type_placeholder_item.rs:205:14
508    |
509 LL |     const C: _;
510    |              ^ not allowed in type signatures
511
512 error[E0121]: the type placeholder `_` is not allowed within types on item signatures
513   --> $DIR/typeck_type_placeholder_item.rs:208:14
514    |
515 LL |     const D: _ = 42;
516    |              ^
517    |              |
518    |              not allowed in type signatures
519    |              help: replace `_` with the correct type: `i32`
520
521 error: aborting due to 67 previous errors
522
523 Some errors have detailed explanations: E0121, E0282, E0403.
524 For more information about an error, try `rustc --explain E0121`.