File: where-allowed.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (450 lines) | stat: -rw-r--r-- 18,842 bytes parent folder | download | duplicates (2)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
error[E0666]: nested `impl Trait` is not allowed
  --> $DIR/where-allowed.rs:50:51
   |
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
   |                                           --------^^^^^^^^^^-
   |                                           |       |
   |                                           |       nested `impl Trait` here
   |                                           outer `impl Trait`

error[E0666]: nested `impl Trait` is not allowed
  --> $DIR/where-allowed.rs:59:57
   |
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
   |                                                 --------^^^^^^^^^^-
   |                                                 |       |
   |                                                 |       nested `impl Trait` here
   |                                                 outer `impl Trait`

error[E0658]: `impl Trait` in associated types is unstable
  --> $DIR/where-allowed.rs:121:16
   |
LL |     type Out = impl Debug;
   |                ^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `impl Trait` in type aliases is unstable
  --> $DIR/where-allowed.rs:158:23
   |
LL | type InTypeAlias<R> = impl Debug;
   |                       ^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `impl Trait` in type aliases is unstable
  --> $DIR/where-allowed.rs:161:39
   |
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
   |                                       ^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in `fn` pointer parameters
  --> $DIR/where-allowed.rs:18:40
   |
LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
   |                                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
  --> $DIR/where-allowed.rs:22:42
   |
LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
   |                                          ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in `fn` pointer parameters
  --> $DIR/where-allowed.rs:26:38
   |
LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
   |                                      ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
  --> $DIR/where-allowed.rs:30:40
   |
LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
   |                                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
  --> $DIR/where-allowed.rs:34:49
   |
LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
   |                                                 ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
  --> $DIR/where-allowed.rs:38:51
   |
LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
   |                                                   ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
  --> $DIR/where-allowed.rs:42:55
   |
LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
   |                                                       ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
  --> $DIR/where-allowed.rs:50:51
   |
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
   |                                                   ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
  --> $DIR/where-allowed.rs:55:53
   |
LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
   |                                                     ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
  --> $DIR/where-allowed.rs:59:57
   |
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
   |                                                         ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
  --> $DIR/where-allowed.rs:68:38
   |
LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
   |                                      ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
  --> $DIR/where-allowed.rs:72:40
   |
LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
   |                                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in field types
  --> $DIR/where-allowed.rs:85:32
   |
LL | struct InBraceStructField { x: impl Debug }
   |                                ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in field types
  --> $DIR/where-allowed.rs:89:41
   |
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
   |                                         ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in field types
  --> $DIR/where-allowed.rs:93:27
   |
LL | struct InTupleStructField(impl Debug);
   |                           ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in field types
  --> $DIR/where-allowed.rs:98:25
   |
LL |     InBraceVariant { x: impl Debug },
   |                         ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in field types
  --> $DIR/where-allowed.rs:100:20
   |
LL |     InTupleVariant(impl Debug),
   |                    ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in `extern fn` parameters
  --> $DIR/where-allowed.rs:142:33
   |
LL |     fn in_foreign_parameters(_: impl Debug);
   |                                 ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in `extern fn` return types
  --> $DIR/where-allowed.rs:145:31
   |
LL |     fn in_foreign_return() -> impl Debug;
   |                               ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
  --> $DIR/where-allowed.rs:161:39
   |
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
   |                                       ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in traits
  --> $DIR/where-allowed.rs:166:16
   |
LL | impl PartialEq<impl Debug> for () {
   |                ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in impl headers
  --> $DIR/where-allowed.rs:171:24
   |
LL | impl PartialEq<()> for impl Debug {
   |                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in impl headers
  --> $DIR/where-allowed.rs:176:6
   |
LL | impl impl Debug {
   |      ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in impl headers
  --> $DIR/where-allowed.rs:182:24
   |
LL | impl InInherentImplAdt<impl Debug> {
   |                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in bounds
  --> $DIR/where-allowed.rs:188:11
   |
LL |     where impl Debug: Debug
   |           ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in bounds
  --> $DIR/where-allowed.rs:195:15
   |
LL |     where Vec<impl Debug>: Debug
   |               ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in bounds
  --> $DIR/where-allowed.rs:202:24
   |
LL |     where T: PartialEq<impl Debug>
   |                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
  --> $DIR/where-allowed.rs:209:17
   |
LL |     where T: Fn(impl Debug)
   |                 ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
  --> $DIR/where-allowed.rs:216:22
   |
LL |     where T: Fn() -> impl Debug
   |                      ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in generic parameter defaults
  --> $DIR/where-allowed.rs:222:40
   |
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
   |                                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in generic parameter defaults
  --> $DIR/where-allowed.rs:226:36
   |
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
   |                                    ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in generic parameter defaults
  --> $DIR/where-allowed.rs:230:38
   |
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
   |                                      ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in generic parameter defaults
  --> $DIR/where-allowed.rs:234:41
   |
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
   |                                         ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in generic parameter defaults
  --> $DIR/where-allowed.rs:238:11
   |
LL | impl <T = impl Debug> T {}
   |           ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in generic parameter defaults
  --> $DIR/where-allowed.rs:245:40
   |
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
   |                                        ^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
  --> $DIR/where-allowed.rs:251:29
   |
LL |     let _in_local_variable: impl Fn() = || {};
   |                             ^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in closure return types
  --> $DIR/where-allowed.rs:253:46
   |
LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
   |                                              ^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods

error[E0053]: method `in_trait_impl_return` has an incompatible type for trait
  --> $DIR/where-allowed.rs:128:34
   |
LL |     type Out = impl Debug;
   |                ---------- the expected opaque type
...
LL |     fn in_trait_impl_return() -> impl Debug { () }
   |                                  ^^^^^^^^^^ expected opaque type, found a different opaque type
   |
note: type in trait
  --> $DIR/where-allowed.rs:118:34
   |
LL |     fn in_trait_impl_return() -> Self::Out;
   |                                  ^^^^^^^^^
   = note: expected signature `fn() -> <() as DummyTrait>::Out`
              found signature `fn() -> impl Debug`
   = note: distinct uses of `impl Trait` result in different opaque types
help: change the output type to match the trait
   |
LL |     fn in_trait_impl_return() -> <() as DummyTrait>::Out { () }
   |                                  ~~~~~~~~~~~~~~~~~~~~~~~

error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
  --> $DIR/where-allowed.rs:245:36
   |
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
   |                                    ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
   = note: `#[deny(invalid_type_param_default)]` on by default

error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
  --> $DIR/where-allowed.rs:238:7
   |
LL | impl <T = impl Debug> T {}
   |       ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>

error[E0283]: type annotations needed
  --> $DIR/where-allowed.rs:46:57
   |
LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
   |                                                         ^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Debug`

error[E0283]: type annotations needed
  --> $DIR/where-allowed.rs:64:46
   |
LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
           - impl<A, F> Fn<A> for &F
             where A: Tuple, F: Fn<A>, F: ?Sized;
           - impl<Args, F, A> Fn<Args> for Box<F, A>
             where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;

error[E0118]: no nominal type found for inherent implementation
  --> $DIR/where-allowed.rs:238:1
   |
LL | impl <T = impl Debug> T {}
   | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
   |
   = note: either implement a trait on it or create a newtype to wrap it instead

error: unconstrained opaque type
  --> $DIR/where-allowed.rs:121:16
   |
LL |     type Out = impl Debug;
   |                ^^^^^^^^^^
   |
   = note: `Out` must be used in combination with a concrete type within the same impl

error: aborting due to 49 previous errors

Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666.
For more information about an error, try `rustc --explain E0053`.
Future incompatibility report: Future breakage diagnostic:
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
  --> $DIR/where-allowed.rs:245:36
   |
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
   |                                    ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
   = note: `#[deny(invalid_type_param_default)]` on by default

Future breakage diagnostic:
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
  --> $DIR/where-allowed.rs:238:7
   |
LL | impl <T = impl Debug> T {}
   |       ^^^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
   = note: `#[deny(invalid_type_param_default)]` on by default