@@ -13,61 +13,61 @@ fn in_adt_in_parameters(_: Vec<impl Debug>) { panic!() }
13
13
14
14
// Disallowed
15
15
fn in_fn_parameter_in_parameters ( _: fn ( impl Debug ) ) { panic ! ( ) }
16
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
16
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
17
17
18
18
// Disallowed
19
19
fn in_fn_return_in_parameters ( _: fn ( ) -> impl Debug ) { panic ! ( ) }
20
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
20
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
21
21
22
22
// Disallowed
23
23
fn in_fn_parameter_in_return ( ) -> fn ( impl Debug ) { panic ! ( ) }
24
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
24
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
25
25
26
26
// Disallowed
27
27
fn in_fn_return_in_return ( ) -> fn ( ) -> impl Debug { panic ! ( ) }
28
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
28
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
29
29
30
30
// Disallowed
31
31
fn in_dyn_Fn_parameter_in_parameters ( _: & dyn Fn ( impl Debug ) ) { panic ! ( ) }
32
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
32
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
33
33
34
34
// Disallowed
35
35
fn in_dyn_Fn_return_in_parameters ( _: & dyn Fn ( ) -> impl Debug ) { panic ! ( ) }
36
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
36
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
37
37
38
38
// Disallowed
39
39
fn in_dyn_Fn_parameter_in_return ( ) -> & ' static dyn Fn ( impl Debug ) { panic ! ( ) }
40
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
40
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
41
41
42
42
// Disallowed
43
43
fn in_dyn_Fn_return_in_return ( ) -> & ' static dyn Fn ( ) -> impl Debug { panic ! ( ) }
44
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
44
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
45
45
46
46
// Disallowed
47
47
fn in_impl_Fn_parameter_in_parameters ( _: & impl Fn ( impl Debug ) ) { panic ! ( ) }
48
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
48
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
49
49
//~^^ ERROR nested `impl Trait` is not allowed
50
50
51
51
// Disallowed
52
52
fn in_impl_Fn_return_in_parameters ( _: & impl Fn ( ) -> impl Debug ) { panic ! ( ) }
53
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
53
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
54
54
55
55
// Disallowed
56
56
fn in_impl_Fn_parameter_in_return ( ) -> & ' static impl Fn ( impl Debug ) { panic ! ( ) }
57
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
57
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
58
58
//~| ERROR nested `impl Trait` is not allowed
59
59
60
60
// Disallowed
61
61
fn in_impl_Fn_return_in_return ( ) -> & ' static impl Fn ( ) -> impl Debug { panic ! ( ) }
62
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
62
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
63
63
64
64
// Disallowed
65
65
fn in_Fn_parameter_in_generics < F : Fn ( impl Debug ) > ( _: F ) { panic ! ( ) }
66
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
66
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
67
67
68
68
// Disallowed
69
69
fn in_Fn_return_in_generics < F : Fn ( ) -> impl Debug > ( _: F ) { panic ! ( ) }
70
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
70
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
71
71
72
72
73
73
// Allowed
@@ -80,22 +80,22 @@ fn in_impl_Trait_in_return() -> impl IntoIterator<Item = impl IntoIterator> {
80
80
81
81
// Disallowed
82
82
struct InBraceStructField { x : impl Debug }
83
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
83
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
84
84
85
85
// Disallowed
86
86
struct InAdtInBraceStructField { x : Vec < impl Debug > }
87
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
87
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
88
88
89
89
// Disallowed
90
90
struct InTupleStructField ( impl Debug ) ;
91
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
91
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
92
92
93
93
// Disallowed
94
94
enum InEnum {
95
95
InBraceVariant { x : impl Debug } ,
96
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
96
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
97
97
InTupleVariant ( impl Debug ) ,
98
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
98
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
99
99
}
100
100
101
101
// Allowed
@@ -106,7 +106,7 @@ trait InTraitDefnParameters {
106
106
// Disallowed
107
107
trait InTraitDefnReturn {
108
108
fn in_return ( ) -> impl Debug ;
109
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
109
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
110
110
}
111
111
112
112
// Allowed and disallowed in trait impls
@@ -123,7 +123,7 @@ impl DummyTrait for () {
123
123
// Allowed
124
124
125
125
fn in_trait_impl_return ( ) -> impl Debug { ( ) }
126
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
126
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
127
127
}
128
128
129
129
// Allowed
@@ -136,10 +136,10 @@ impl DummyType {
136
136
// Disallowed
137
137
extern "C" {
138
138
fn in_foreign_parameters ( _: impl Debug ) ;
139
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
139
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
140
140
141
141
fn in_foreign_return ( ) -> impl Debug ;
142
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
142
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
143
143
}
144
144
145
145
// Allowed
@@ -155,96 +155,96 @@ type InTypeAlias<R> = impl Debug;
155
155
//~^ ERROR `impl Trait` in type aliases is unstable
156
156
157
157
type InReturnInTypeAlias < R > = fn ( ) -> impl Debug ;
158
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
158
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
159
159
//~| ERROR `impl Trait` in type aliases is unstable
160
160
161
161
// Disallowed in impl headers
162
162
impl PartialEq < impl Debug > for ( ) {
163
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
163
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
164
164
}
165
165
166
166
// Disallowed in impl headers
167
167
impl PartialEq < ( ) > for impl Debug {
168
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
168
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
169
169
}
170
170
171
171
// Disallowed in inherent impls
172
172
impl impl Debug {
173
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
173
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
174
174
}
175
175
176
176
// Disallowed in inherent impls
177
177
struct InInherentImplAdt < T > { t : T }
178
178
impl InInherentImplAdt < impl Debug > {
179
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
179
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
180
180
}
181
181
182
182
// Disallowed in where clauses
183
183
fn in_fn_where_clause ( )
184
184
where impl Debug : Debug
185
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
185
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
186
186
{
187
187
}
188
188
189
189
// Disallowed in where clauses
190
190
fn in_adt_in_fn_where_clause ( )
191
191
where Vec < impl Debug > : Debug
192
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
192
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
193
193
{
194
194
}
195
195
196
196
// Disallowed
197
197
fn in_trait_parameter_in_fn_where_clause < T > ( )
198
198
where T : PartialEq < impl Debug >
199
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
199
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
200
200
{
201
201
}
202
202
203
203
// Disallowed
204
204
fn in_Fn_parameter_in_fn_where_clause < T > ( )
205
205
where T : Fn ( impl Debug )
206
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
206
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
207
207
{
208
208
}
209
209
210
210
// Disallowed
211
211
fn in_Fn_return_in_fn_where_clause < T > ( )
212
212
where T : Fn ( ) -> impl Debug
213
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
213
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
214
214
{
215
215
}
216
216
217
217
// Disallowed
218
218
struct InStructGenericParamDefault < T = impl Debug > ( T ) ;
219
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
219
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
220
220
221
221
// Disallowed
222
222
enum InEnumGenericParamDefault < T = impl Debug > { Variant ( T ) }
223
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
223
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
224
224
225
225
// Disallowed
226
226
trait InTraitGenericParamDefault < T = impl Debug > { }
227
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
227
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
228
228
229
229
// Disallowed
230
230
type InTypeAliasGenericParamDefault < T = impl Debug > = T ;
231
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
231
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
232
232
233
233
// Disallowed
234
234
impl < T = impl Debug > T { }
235
235
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
236
236
//~| WARNING this was previously accepted by the compiler but is being phased out
237
- //~| ERROR `impl Trait` not allowed outside of function and inherent method return types
237
+ //~| ERROR `impl Trait` not allowed outside of function and method return types
238
238
239
239
// Disallowed
240
240
fn in_method_generic_param_default < T = impl Debug > ( _: T ) { }
241
241
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
242
242
//~| WARNING this was previously accepted by the compiler but is being phased out
243
- //~| ERROR `impl Trait` not allowed outside of function and inherent method return types
243
+ //~| ERROR `impl Trait` not allowed outside of function and method return types
244
244
245
245
fn main ( ) {
246
246
let _in_local_variable: impl Fn ( ) = || { } ;
247
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
247
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
248
248
let _in_return_in_local_variable = || -> impl Fn ( ) { || { } } ;
249
- //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
249
+ //~^ ERROR `impl Trait` not allowed outside of function and method return types
250
250
}
0 commit comments