fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
14.1 KiB316 linesraw
1error[E0666]: nested `impl Trait` is not allowed
2  --> $DIR/where-allowed.rs:49:51
3   |
4LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
5   |                                           --------^^^^^^^^^^-
6   |                                           |       |
7   |                                           |       nested `impl Trait` here
8   |                                           outer `impl Trait`
9
10error[E0666]: nested `impl Trait` is not allowed
11  --> $DIR/where-allowed.rs:58:57
12   |
13LL | 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
19error[E0658]: `impl Trait` in associated types is unstable
20  --> $DIR/where-allowed.rs:120:16
21   |
22LL |     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(impl_trait_in_assoc_type)]` to the crate attributes to enable
27
28error[E0658]: `impl Trait` in type aliases is unstable
29  --> $DIR/where-allowed.rs:155:23
30   |
31LL | 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
37error[E0658]: `impl Trait` in type aliases is unstable
38  --> $DIR/where-allowed.rs:158:39
39   |
40LL | 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
46error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
47  --> $DIR/where-allowed.rs:18:40
48   |
49LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
50   |                                        ^^^^^^^^^^
51
52error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
53  --> $DIR/where-allowed.rs:22:42
54   |
55LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
56   |                                          ^^^^^^^^^^
57
58error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
59  --> $DIR/where-allowed.rs:26:38
60   |
61LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
62   |                                      ^^^^^^^^^^
63
64error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
65  --> $DIR/where-allowed.rs:30:40
66   |
67LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
68   |                                        ^^^^^^^^^^
69
70error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
71  --> $DIR/where-allowed.rs:34:49
72   |
73LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
74   |                                                 ^^^^^^^^^^
75
76error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
77  --> $DIR/where-allowed.rs:38:51
78   |
79LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
80   |                                                   ^^^^^^^^^^
81
82error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
83  --> $DIR/where-allowed.rs:42:55
84   |
85LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
86   |                                                       ^^^^^^^^^^
87
88error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
89  --> $DIR/where-allowed.rs:49:51
90   |
91LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
92   |                                                   ^^^^^^^^^^
93
94error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
95  --> $DIR/where-allowed.rs:54:53
96   |
97LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
98   |                                                     ^^^^^^^^^^
99
100error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
101  --> $DIR/where-allowed.rs:58:57
102   |
103LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
104   |                                                         ^^^^^^^^^^
105
106error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
107  --> $DIR/where-allowed.rs:66:38
108   |
109LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
110   |                                      ^^^^^^^^^^
111
112error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
113  --> $DIR/where-allowed.rs:70:40
114   |
115LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
116   |                                        ^^^^^^^^^^
117
118error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
119  --> $DIR/where-allowed.rs:83:32
120   |
121LL | struct InBraceStructField { x: impl Debug }
122   |                                ^^^^^^^^^^
123
124error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
125  --> $DIR/where-allowed.rs:87:41
126   |
127LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
128   |                                         ^^^^^^^^^^
129
130error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
131  --> $DIR/where-allowed.rs:91:27
132   |
133LL | struct InTupleStructField(impl Debug);
134   |                           ^^^^^^^^^^
135
136error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
137  --> $DIR/where-allowed.rs:96:25
138   |
139LL |     InBraceVariant { x: impl Debug },
140   |                         ^^^^^^^^^^
141
142error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
143  --> $DIR/where-allowed.rs:98:20
144   |
145LL |     InTupleVariant(impl Debug),
146   |                    ^^^^^^^^^^
147
148error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return types
149  --> $DIR/where-allowed.rs:109:23
150   |
151LL |     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
157error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `impl` method return types
158  --> $DIR/where-allowed.rs:126:34
159   |
160LL |     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
166error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` params
167  --> $DIR/where-allowed.rs:139:33
168   |
169LL |     fn in_foreign_parameters(_: impl Debug);
170   |                                 ^^^^^^^^^^
171
172error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` return types
173  --> $DIR/where-allowed.rs:142:31
174   |
175LL |     fn in_foreign_return() -> impl Debug;
176   |                               ^^^^^^^^^^
177
178error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
179  --> $DIR/where-allowed.rs:158:39
180   |
181LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
182   |                                       ^^^^^^^^^^
183
184error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in traits
185  --> $DIR/where-allowed.rs:163:16
186   |
187LL | impl PartialEq<impl Debug> for () {
188   |                ^^^^^^^^^^
189
190error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
191  --> $DIR/where-allowed.rs:168:24
192   |
193LL | impl PartialEq<()> for impl Debug {
194   |                        ^^^^^^^^^^
195
196error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
197  --> $DIR/where-allowed.rs:173:6
198   |
199LL | impl impl Debug {
200   |      ^^^^^^^^^^
201
202error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
203  --> $DIR/where-allowed.rs:179:24
204   |
205LL | impl InInherentImplAdt<impl Debug> {
206   |                        ^^^^^^^^^^
207
208error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
209  --> $DIR/where-allowed.rs:185:11
210   |
211LL |     where impl Debug: Debug
212   |           ^^^^^^^^^^
213
214error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
215  --> $DIR/where-allowed.rs:192:15
216   |
217LL |     where Vec<impl Debug>: Debug
218   |               ^^^^^^^^^^
219
220error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
221  --> $DIR/where-allowed.rs:199:24
222   |
223LL |     where T: PartialEq<impl Debug>
224   |                        ^^^^^^^^^^
225
226error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
227  --> $DIR/where-allowed.rs:206:17
228   |
229LL |     where T: Fn(impl Debug)
230   |                 ^^^^^^^^^^
231
232error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
233  --> $DIR/where-allowed.rs:213:22
234   |
235LL |     where T: Fn() -> impl Debug
236   |                      ^^^^^^^^^^
237
238error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
239  --> $DIR/where-allowed.rs:219:40
240   |
241LL | struct InStructGenericParamDefault<T = impl Debug>(T);
242   |                                        ^^^^^^^^^^
243
244error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
245  --> $DIR/where-allowed.rs:223:36
246   |
247LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
248   |                                    ^^^^^^^^^^
249
250error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
251  --> $DIR/where-allowed.rs:227:38
252   |
253LL | trait InTraitGenericParamDefault<T = impl Debug> {}
254   |                                      ^^^^^^^^^^
255
256error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
257  --> $DIR/where-allowed.rs:231:41
258   |
259LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
260   |                                         ^^^^^^^^^^
261
262error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
263  --> $DIR/where-allowed.rs:235:11
264   |
265LL | impl <T = impl Debug> T {}
266   |           ^^^^^^^^^^
267
268error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
269  --> $DIR/where-allowed.rs:242:40
270   |
271LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
272   |                                        ^^^^^^^^^^
273
274error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
275  --> $DIR/where-allowed.rs:248:29
276   |
277LL |     let _in_local_variable: impl Fn() = || {};
278   |                             ^^^^^^^^^
279
280error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in closure return types
281  --> $DIR/where-allowed.rs:250:46
282   |
283LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
284   |                                              ^^^^^^^^^
285
286error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
287  --> $DIR/where-allowed.rs:235:7
288   |
289LL | 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
296error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
297  --> $DIR/where-allowed.rs:242:36
298   |
299LL | 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
305error[E0118]: no nominal type found for inherent implementation
306  --> $DIR/where-allowed.rs:235:1
307   |
308LL | 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
313error: aborting due to 47 previous errors
314
315Some errors have detailed explanations: E0118, E0562, E0658, E0666.
316For more information about an error, try `rustc --explain E0118`.