]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/where-allowed.stderr
Add more information to `impl Trait` deny error
[rust.git] / src / test / ui / impl-trait / where-allowed.stderr
1 error[E0666]: nested `impl Trait` is not allowed
2   --> $DIR/where-allowed.rs:47:51
3    |
4 LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
5    |                                           --------^^^^^^^^^^-
6    |                                           |       |
7    |                                           |       nested `impl Trait` here
8    |                                           outer `impl Trait`
9
10 error[E0666]: nested `impl Trait` is not allowed
11   --> $DIR/where-allowed.rs:56:57
12    |
13 LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
14    |                                                 --------^^^^^^^^^^-
15    |                                                 |       |
16    |                                                 |       nested `impl Trait` here
17    |                                                 outer `impl Trait`
18
19 error[E0658]: `impl Trait` in type aliases is unstable
20   --> $DIR/where-allowed.rs:119:16
21    |
22 LL |     type Out = impl Debug;
23    |                ^^^^^^^^^^
24    |
25    = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
26    = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
27
28 error[E0658]: `impl Trait` in type aliases is unstable
29   --> $DIR/where-allowed.rs:154:23
30    |
31 LL | type InTypeAlias<R> = impl Debug;
32    |                       ^^^^^^^^^^
33    |
34    = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
35    = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
36
37 error[E0658]: `impl Trait` in type aliases is unstable
38   --> $DIR/where-allowed.rs:157:39
39    |
40 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
41    |                                       ^^^^^^^^^^
42    |
43    = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
44    = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
45
46 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
47   --> $DIR/where-allowed.rs:15:40
48    |
49 LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
50    |                                        ^^^^^^^^^^
51    |
52    = note: found `impl Trait` in `fn` pointer param
53
54 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
55   --> $DIR/where-allowed.rs:19:42
56    |
57 LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
58    |                                          ^^^^^^^^^^
59    |
60    = note: found `impl Trait` in `fn` pointer return
61
62 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
63   --> $DIR/where-allowed.rs:23:38
64    |
65 LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
66    |                                      ^^^^^^^^^^
67    |
68    = note: found `impl Trait` in `fn` pointer param
69
70 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
71   --> $DIR/where-allowed.rs:27:40
72    |
73 LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
74    |                                        ^^^^^^^^^^
75    |
76    = note: found `impl Trait` in `fn` pointer return
77
78 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
79   --> $DIR/where-allowed.rs:31:49
80    |
81 LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
82    |                                                 ^^^^^^^^^^
83    |
84    = note: found `impl Trait` in `Fn` trait param
85
86 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
87   --> $DIR/where-allowed.rs:35:51
88    |
89 LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
90    |                                                   ^^^^^^^^^^
91    |
92    = note: found `impl Trait` in `Fn` trait return
93
94 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
95   --> $DIR/where-allowed.rs:39:55
96    |
97 LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
98    |                                                       ^^^^^^^^^^
99    |
100    = note: found `impl Trait` in `Fn` trait param
101
102 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
103   --> $DIR/where-allowed.rs:43:57
104    |
105 LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
106    |                                                         ^^^^^^^^^^
107    |
108    = note: found `impl Trait` in `Fn` trait return
109
110 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
111   --> $DIR/where-allowed.rs:47:51
112    |
113 LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
114    |                                                   ^^^^^^^^^^
115    |
116    = note: found `impl Trait` in `Fn` trait param
117
118 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
119   --> $DIR/where-allowed.rs:52:53
120    |
121 LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
122    |                                                     ^^^^^^^^^^
123    |
124    = note: found `impl Trait` in `Fn` trait return
125
126 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
127   --> $DIR/where-allowed.rs:56:57
128    |
129 LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
130    |                                                         ^^^^^^^^^^
131    |
132    = note: found `impl Trait` in `Fn` trait param
133
134 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
135   --> $DIR/where-allowed.rs:61:59
136    |
137 LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
138    |                                                           ^^^^^^^^^^
139    |
140    = note: found `impl Trait` in `Fn` trait return
141
142 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
143   --> $DIR/where-allowed.rs:65:38
144    |
145 LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
146    |                                      ^^^^^^^^^^
147    |
148    = note: found `impl Trait` in `Fn` trait param
149
150 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
151   --> $DIR/where-allowed.rs:69:40
152    |
153 LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
154    |                                        ^^^^^^^^^^
155    |
156    = note: found `impl Trait` in `Fn` trait return
157
158 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
159   --> $DIR/where-allowed.rs:82:32
160    |
161 LL | struct InBraceStructField { x: impl Debug }
162    |                                ^^^^^^^^^^
163    |
164    = note: found `impl Trait` in type
165
166 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
167   --> $DIR/where-allowed.rs:86:41
168    |
169 LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
170    |                                         ^^^^^^^^^^
171    |
172    = note: found `impl Trait` in path
173
174 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
175   --> $DIR/where-allowed.rs:90:27
176    |
177 LL | struct InTupleStructField(impl Debug);
178    |                           ^^^^^^^^^^
179    |
180    = note: found `impl Trait` in type
181
182 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
183   --> $DIR/where-allowed.rs:95:25
184    |
185 LL |     InBraceVariant { x: impl Debug },
186    |                         ^^^^^^^^^^
187    |
188    = note: found `impl Trait` in type
189
190 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
191   --> $DIR/where-allowed.rs:97:20
192    |
193 LL |     InTupleVariant(impl Debug),
194    |                    ^^^^^^^^^^
195    |
196    = note: found `impl Trait` in type
197
198 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
199   --> $DIR/where-allowed.rs:108:23
200    |
201 LL |     fn in_return() -> impl Debug;
202    |                       ^^^^^^^^^^
203    |
204    = note: found `impl Trait` in trait method return
205
206 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
207   --> $DIR/where-allowed.rs:125:34
208    |
209 LL |     fn in_trait_impl_return() -> impl Debug { () }
210    |                                  ^^^^^^^^^^
211    |
212    = note: found `impl Trait` in `impl` method return
213
214 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
215   --> $DIR/where-allowed.rs:138:33
216    |
217 LL |     fn in_foreign_parameters(_: impl Debug);
218    |                                 ^^^^^^^^^^
219    |
220    = note: found `impl Trait` in `extern fn` param
221
222 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
223   --> $DIR/where-allowed.rs:141:31
224    |
225 LL |     fn in_foreign_return() -> impl Debug;
226    |                               ^^^^^^^^^^
227    |
228    = note: found `impl Trait` in `extern fn` return
229
230 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
231   --> $DIR/where-allowed.rs:157:39
232    |
233 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
234    |                                       ^^^^^^^^^^
235    |
236    = note: found `impl Trait` in `fn` pointer return
237
238 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
239   --> $DIR/where-allowed.rs:162:16
240    |
241 LL | impl PartialEq<impl Debug> for () {
242    |                ^^^^^^^^^^
243    |
244    = note: found `impl Trait` in trait
245
246 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
247   --> $DIR/where-allowed.rs:167:24
248    |
249 LL | impl PartialEq<()> for impl Debug {
250    |                        ^^^^^^^^^^
251    |
252    = note: found `impl Trait` in type
253
254 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
255   --> $DIR/where-allowed.rs:172:6
256    |
257 LL | impl impl Debug {
258    |      ^^^^^^^^^^
259    |
260    = note: found `impl Trait` in type
261
262 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
263   --> $DIR/where-allowed.rs:178:24
264    |
265 LL | impl InInherentImplAdt<impl Debug> {
266    |                        ^^^^^^^^^^
267    |
268    = note: found `impl Trait` in type
269
270 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
271   --> $DIR/where-allowed.rs:184:11
272    |
273 LL |     where impl Debug: Debug
274    |           ^^^^^^^^^^
275    |
276    = note: found `impl Trait` in type
277
278 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
279   --> $DIR/where-allowed.rs:191:15
280    |
281 LL |     where Vec<impl Debug>: Debug
282    |               ^^^^^^^^^^
283    |
284    = note: found `impl Trait` in type
285
286 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
287   --> $DIR/where-allowed.rs:198:24
288    |
289 LL |     where T: PartialEq<impl Debug>
290    |                        ^^^^^^^^^^
291    |
292    = note: found `impl Trait` in bound
293
294 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
295   --> $DIR/where-allowed.rs:205:17
296    |
297 LL |     where T: Fn(impl Debug)
298    |                 ^^^^^^^^^^
299    |
300    = note: found `impl Trait` in `Fn` trait param
301
302 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
303   --> $DIR/where-allowed.rs:212:22
304    |
305 LL |     where T: Fn() -> impl Debug
306    |                      ^^^^^^^^^^
307    |
308    = note: found `impl Trait` in `Fn` trait return
309
310 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
311   --> $DIR/where-allowed.rs:218:40
312    |
313 LL | struct InStructGenericParamDefault<T = impl Debug>(T);
314    |                                        ^^^^^^^^^^
315    |
316    = note: found `impl Trait` in type
317
318 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
319   --> $DIR/where-allowed.rs:222:36
320    |
321 LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
322    |                                    ^^^^^^^^^^
323    |
324    = note: found `impl Trait` in type
325
326 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
327   --> $DIR/where-allowed.rs:226:38
328    |
329 LL | trait InTraitGenericParamDefault<T = impl Debug> {}
330    |                                      ^^^^^^^^^^
331    |
332    = note: found `impl Trait` in type
333
334 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
335   --> $DIR/where-allowed.rs:230:41
336    |
337 LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
338    |                                         ^^^^^^^^^^
339    |
340    = note: found `impl Trait` in type
341
342 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
343   --> $DIR/where-allowed.rs:234:11
344    |
345 LL | impl <T = impl Debug> T {}
346    |           ^^^^^^^^^^
347    |
348    = note: found `impl Trait` in type
349
350 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
351   --> $DIR/where-allowed.rs:241:40
352    |
353 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
354    |                                        ^^^^^^^^^^
355    |
356    = note: found `impl Trait` in type
357
358 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
359   --> $DIR/where-allowed.rs:247:29
360    |
361 LL |     let _in_local_variable: impl Fn() = || {};
362    |                             ^^^^^^^^^
363    |
364    = note: found `impl Trait` in variable
365
366 error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
367   --> $DIR/where-allowed.rs:249:46
368    |
369 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
370    |                                              ^^^^^^^^^
371    |
372    = note: found `impl Trait` in closure return
373
374 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
375   --> $DIR/where-allowed.rs:234:7
376    |
377 LL | impl <T = impl Debug> T {}
378    |       ^
379    |
380    = note: `#[deny(invalid_type_param_default)]` on by default
381    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
382    = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
383
384 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
385   --> $DIR/where-allowed.rs:241:36
386    |
387 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
388    |                                    ^
389    |
390    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
391    = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
392
393 error[E0118]: no nominal type found for inherent implementation
394   --> $DIR/where-allowed.rs:234:23
395    |
396 LL | impl <T = impl Debug> T {}
397    |                       ^ impl requires a nominal type
398    |
399    = note: either implement a trait on it or create a newtype to wrap it instead
400
401 error: aborting due to 49 previous errors
402
403 Some errors have detailed explanations: E0118, E0562, E0658, E0666.
404 For more information about an error, try `rustc --explain E0118`.