]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/where-allowed.stderr
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
[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:118: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:153: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:156: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` only allowed in function and inherent method return types, not in `fn` pointer param
47   --> $DIR/where-allowed.rs:16:40
48    |
49 LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
50    |                                        ^^^^^^^^^^
51
52 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return
53   --> $DIR/where-allowed.rs:20:42
54    |
55 LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
56    |                                          ^^^^^^^^^^
57
58 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer param
59   --> $DIR/where-allowed.rs:24:38
60    |
61 LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
62    |                                      ^^^^^^^^^^
63
64 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return
65   --> $DIR/where-allowed.rs:28:40
66    |
67 LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
68    |                                        ^^^^^^^^^^
69
70 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param
71   --> $DIR/where-allowed.rs:32:49
72    |
73 LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
74    |                                                 ^^^^^^^^^^
75
76 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
77   --> $DIR/where-allowed.rs:36:51
78    |
79 LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
80    |                                                   ^^^^^^^^^^
81
82 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param
83   --> $DIR/where-allowed.rs:40:55
84    |
85 LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
86    |                                                       ^^^^^^^^^^
87
88 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param
89   --> $DIR/where-allowed.rs:47:51
90    |
91 LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
92    |                                                   ^^^^^^^^^^
93
94 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
95   --> $DIR/where-allowed.rs:52:53
96    |
97 LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
98    |                                                     ^^^^^^^^^^
99
100 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param
101   --> $DIR/where-allowed.rs:56:57
102    |
103 LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
104    |                                                         ^^^^^^^^^^
105
106 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param
107   --> $DIR/where-allowed.rs:64:38
108    |
109 LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
110    |                                      ^^^^^^^^^^
111
112 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
113   --> $DIR/where-allowed.rs:68:40
114    |
115 LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
116    |                                        ^^^^^^^^^^
117
118 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
119   --> $DIR/where-allowed.rs:81:32
120    |
121 LL | struct InBraceStructField { x: impl Debug }
122    |                                ^^^^^^^^^^
123
124 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in path
125   --> $DIR/where-allowed.rs:85:41
126    |
127 LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
128    |                                         ^^^^^^^^^^
129
130 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
131   --> $DIR/where-allowed.rs:89:27
132    |
133 LL | struct InTupleStructField(impl Debug);
134    |                           ^^^^^^^^^^
135
136 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
137   --> $DIR/where-allowed.rs:94:25
138    |
139 LL |     InBraceVariant { x: impl Debug },
140    |                         ^^^^^^^^^^
141
142 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
143   --> $DIR/where-allowed.rs:96:20
144    |
145 LL |     InTupleVariant(impl Debug),
146    |                    ^^^^^^^^^^
147
148 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
149   --> $DIR/where-allowed.rs:107:23
150    |
151 LL |     fn in_return() -> impl Debug;
152    |                       ^^^^^^^^^^
153    |
154    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
155    = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
156
157 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return
158   --> $DIR/where-allowed.rs:124:34
159    |
160 LL |     fn in_trait_impl_return() -> impl Debug { () }
161    |                                  ^^^^^^^^^^
162    |
163    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
164    = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
165
166 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` param
167   --> $DIR/where-allowed.rs:137:33
168    |
169 LL |     fn in_foreign_parameters(_: impl Debug);
170    |                                 ^^^^^^^^^^
171
172 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return
173   --> $DIR/where-allowed.rs:140:31
174    |
175 LL |     fn in_foreign_return() -> impl Debug;
176    |                               ^^^^^^^^^^
177
178 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return
179   --> $DIR/where-allowed.rs:156:39
180    |
181 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
182    |                                       ^^^^^^^^^^
183
184 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait
185   --> $DIR/where-allowed.rs:161:16
186    |
187 LL | impl PartialEq<impl Debug> for () {
188    |                ^^^^^^^^^^
189
190 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
191   --> $DIR/where-allowed.rs:166:24
192    |
193 LL | impl PartialEq<()> for impl Debug {
194    |                        ^^^^^^^^^^
195
196 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
197   --> $DIR/where-allowed.rs:171:6
198    |
199 LL | impl impl Debug {
200    |      ^^^^^^^^^^
201
202 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
203   --> $DIR/where-allowed.rs:177:24
204    |
205 LL | impl InInherentImplAdt<impl Debug> {
206    |                        ^^^^^^^^^^
207
208 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
209   --> $DIR/where-allowed.rs:183:11
210    |
211 LL |     where impl Debug: Debug
212    |           ^^^^^^^^^^
213
214 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
215   --> $DIR/where-allowed.rs:190:15
216    |
217 LL |     where Vec<impl Debug>: Debug
218    |               ^^^^^^^^^^
219
220 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bound
221   --> $DIR/where-allowed.rs:197:24
222    |
223 LL |     where T: PartialEq<impl Debug>
224    |                        ^^^^^^^^^^
225
226 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param
227   --> $DIR/where-allowed.rs:204:17
228    |
229 LL |     where T: Fn(impl Debug)
230    |                 ^^^^^^^^^^
231
232 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
233   --> $DIR/where-allowed.rs:211:22
234    |
235 LL |     where T: Fn() -> impl Debug
236    |                      ^^^^^^^^^^
237
238 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
239   --> $DIR/where-allowed.rs:217:40
240    |
241 LL | struct InStructGenericParamDefault<T = impl Debug>(T);
242    |                                        ^^^^^^^^^^
243
244 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
245   --> $DIR/where-allowed.rs:221:36
246    |
247 LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
248    |                                    ^^^^^^^^^^
249
250 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
251   --> $DIR/where-allowed.rs:225:38
252    |
253 LL | trait InTraitGenericParamDefault<T = impl Debug> {}
254    |                                      ^^^^^^^^^^
255
256 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
257   --> $DIR/where-allowed.rs:229:41
258    |
259 LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
260    |                                         ^^^^^^^^^^
261
262 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
263   --> $DIR/where-allowed.rs:233:11
264    |
265 LL | impl <T = impl Debug> T {}
266    |           ^^^^^^^^^^
267
268 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type
269   --> $DIR/where-allowed.rs:240:40
270    |
271 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
272    |                                        ^^^^^^^^^^
273
274 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
275   --> $DIR/where-allowed.rs:246:29
276    |
277 LL |     let _in_local_variable: impl Fn() = || {};
278    |                             ^^^^^^^^^
279
280 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return
281   --> $DIR/where-allowed.rs:248:46
282    |
283 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
284    |                                              ^^^^^^^^^
285
286 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
287   --> $DIR/where-allowed.rs:233:7
288    |
289 LL | impl <T = impl Debug> T {}
290    |       ^^^^^^^^^^^^^^
291    |
292    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
293    = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
294    = note: `#[deny(invalid_type_param_default)]` on by default
295
296 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
297   --> $DIR/where-allowed.rs:240:36
298    |
299 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
300    |                                    ^^^^^^^^^^^^^^
301    |
302    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
303    = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
304
305 error[E0118]: no nominal type found for inherent implementation
306   --> $DIR/where-allowed.rs:233:23
307    |
308 LL | impl <T = impl Debug> T {}
309    |                       ^ impl requires a nominal type
310    |
311    = note: either implement a trait on it or create a newtype to wrap it instead
312
313 error: aborting due to 47 previous errors
314
315 Some errors have detailed explanations: E0118, E0562, E0658, E0666.
316 For more information about an error, try `rustc --explain E0118`.