@@ -36,6 +36,10 @@ mod type_and_type {
36
36
type D = Ty < usize , String , char > ;
37
37
//~^ ERROR this struct takes 2 generic arguments but 3 generic arguments
38
38
//~| HELP remove this
39
+
40
+ type E = Ty < > ;
41
+ //~^ ERROR this struct takes 2 generic arguments but 0 generic arguments were supplied
42
+ //~| HELP add missing
39
43
}
40
44
41
45
mod lifetime_and_type {
@@ -56,6 +60,12 @@ mod lifetime_and_type {
56
60
//~| HELP consider introducing
57
61
58
62
type D = Ty < ' static , usize > ;
63
+
64
+ type E = Ty < > ;
65
+ //~^ ERROR this struct takes 1 generic argument but 0 generic arguments
66
+ //~| ERROR missing lifetime specifier
67
+ //~| HELP consider introducing
68
+ //~| HELP add missing
59
69
}
60
70
61
71
mod type_and_type_and_type {
@@ -76,6 +86,10 @@ mod type_and_type_and_type {
76
86
type E = Ty < usize , String , char , f64 > ;
77
87
//~^ ERROR this struct takes at most 3
78
88
//~| HELP remove
89
+
90
+ type F = Ty < > ;
91
+ //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
92
+ //~| HELP add missing
79
93
}
80
94
81
95
// Traits have an implicit `Self` type - these tests ensure we don't accidentally return it
@@ -112,6 +126,166 @@ mod r#trait {
112
126
type E = Box < dyn GenericType < String , usize > > ;
113
127
//~^ ERROR this trait takes 1 generic argument but 2 generic arguments
114
128
//~| HELP remove
129
+
130
+ type F = Box < dyn GenericLifetime < > > ;
131
+ //~^ ERROR missing lifetime specifier
132
+ //~| HELP consider introducing
133
+
134
+ type G = Box < dyn GenericType < > > ;
135
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
136
+ //~| HELP add missing
137
+ }
138
+
139
+ mod associated_item {
140
+ mod non_generic {
141
+ trait NonGenericAT {
142
+ type AssocTy ;
143
+ }
144
+
145
+ type A = Box < dyn NonGenericAT < usize , AssocTy =( ) > > ;
146
+ //~^ ERROR this trait takes 0 generic arguments but 1 generic argument
147
+ //~| HELP remove
148
+ }
149
+
150
+ mod lifetime {
151
+ trait GenericLifetimeAT < ' a > {
152
+ type AssocTy ;
153
+ }
154
+
155
+ type A = Box < dyn GenericLifetimeAT < AssocTy =( ) > > ;
156
+ //~^ ERROR missing lifetime specifier
157
+ //~| HELP consider introducing
158
+
159
+ type B = Box < dyn GenericLifetimeAT < ' static , ' static , AssocTy =( ) > > ;
160
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
161
+ //~| HELP remove
162
+
163
+ type C = Box < dyn GenericLifetimeAT < ( ) , AssocTy =( ) > > ;
164
+ //~^ ERROR missing lifetime specifier
165
+ //~| HELP consider introducing
166
+ //~| ERROR this trait takes 0 generic arguments but 1 generic argument
167
+ //~| HELP remove
168
+ }
169
+
170
+ mod r#type {
171
+ trait GenericTypeAT < A > {
172
+ type AssocTy ;
173
+ }
174
+
175
+ type A = Box < dyn GenericTypeAT < AssocTy =( ) > > ;
176
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
177
+ //~| HELP add missing
178
+
179
+ type B = Box < dyn GenericTypeAT < ( ) , ( ) , AssocTy =( ) > > ;
180
+ //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
181
+ //~| HELP remove
182
+
183
+ type C = Box < dyn GenericTypeAT < ' static , AssocTy =( ) > > ;
184
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
185
+ //~| HELP add missing
186
+ //~| ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
187
+ //~| HELP remove
188
+ }
189
+
190
+ mod lifetime_and_type {
191
+ trait GenericLifetimeTypeAT < ' a , A > {
192
+ type AssocTy ;
193
+ }
194
+
195
+ type A = Box < dyn GenericLifetimeTypeAT < AssocTy =( ) > > ;
196
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
197
+ //~| HELP add missing
198
+ //~| ERROR missing lifetime specifier
199
+ //~| HELP consider introducing
200
+
201
+ type B = Box < dyn GenericLifetimeTypeAT < ' static , AssocTy =( ) > > ;
202
+ //~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
203
+ //~| HELP add missing
204
+
205
+ type C = Box < dyn GenericLifetimeTypeAT < ' static , ' static , AssocTy =( ) > > ;
206
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
207
+ //~| HELP remove
208
+ //~| ERROR this trait takes 1 generic argument but 0 generic arguments
209
+ //~| HELP add missing
210
+
211
+ type D = Box < dyn GenericLifetimeTypeAT < ( ) , AssocTy =( ) > > ;
212
+ //~^ ERROR missing lifetime specifier
213
+ //~| HELP consider introducing
214
+
215
+ type E = Box < dyn GenericLifetimeTypeAT < ( ) , ( ) , AssocTy =( ) > > ;
216
+ //~^ ERROR missing lifetime specifier
217
+ //~| HELP consider introducing
218
+ //~| ERROR this trait takes 1 generic argument but 2 generic arguments
219
+ //~| HELP remove
220
+
221
+ type F = Box < dyn GenericLifetimeTypeAT < ' static , ' static , ( ) , AssocTy =( ) > > ;
222
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
223
+ //~| HELP remove
224
+
225
+ type G = Box < dyn GenericLifetimeTypeAT < ' static , ( ) , ( ) , AssocTy =( ) > > ;
226
+ //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
227
+ //~| HELP remove
228
+
229
+ type H = Box < dyn GenericLifetimeTypeAT < ' static , ' static , ( ) , ( ) , AssocTy =( ) > > ;
230
+ //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
231
+ //~| HELP remove
232
+ //~| ERROR this trait takes 1 generic argument but 2 generic arguments
233
+ //~| HELP remove
234
+ }
235
+
236
+ mod type_and_type {
237
+ trait GenericTypeTypeAT < A , B > {
238
+ type AssocTy ;
239
+ }
240
+
241
+ type A = Box < dyn GenericTypeTypeAT < AssocTy =( ) > > ;
242
+ //~^ ERROR this trait takes 2 generic arguments but 0 generic arguments
243
+ //~| HELP add missing
244
+
245
+ type B = Box < dyn GenericTypeTypeAT < ( ) , AssocTy =( ) > > ;
246
+ //~^ ERROR this trait takes 2 generic arguments but 1 generic argument
247
+ //~| HELP add missing
248
+
249
+ type C = Box < dyn GenericTypeTypeAT < ( ) , ( ) , ( ) , AssocTy =( ) > > ;
250
+ //~^ ERROR this trait takes 2 generic arguments but 3 generic arguments
251
+ //~| HELP remove
252
+ }
253
+
254
+ mod lifetime_and_lifetime {
255
+ trait GenericLifetimeLifetimeAT < ' a , ' b > {
256
+ type AssocTy ;
257
+ }
258
+
259
+ type A = Box < dyn GenericLifetimeLifetimeAT < AssocTy =( ) > > ;
260
+ //~^ ERROR missing lifetime specifier
261
+ //~| HELP consider introducing
262
+
263
+ type B = Box < dyn GenericLifetimeLifetimeAT < ' static , AssocTy =( ) > > ;
264
+ //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
265
+ //~| HELP add missing lifetime argument
266
+ }
267
+
268
+ mod lifetime_and_lifetime_and_type {
269
+ trait GenericLifetimeLifetimeTypeAT < ' a , ' b , A > {
270
+ type AssocTy ;
271
+ }
272
+
273
+ type A = Box < dyn GenericLifetimeLifetimeTypeAT < AssocTy =( ) > > ;
274
+ //~^ ERROR missing lifetime specifier
275
+ //~| HELP consider introducing
276
+ //~| ERROR this trait takes 1 generic argument but 0 generic arguments
277
+ //~| HELP add missing
278
+
279
+ type B = Box < dyn GenericLifetimeLifetimeTypeAT < ' static , AssocTy =( ) > > ;
280
+ //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
281
+ //~| HELP add missing lifetime argument
282
+ //~| ERROR this trait takes 1 generic argument but 0 generic arguments
283
+ //~| HELP add missing
284
+
285
+ type C = Box < dyn GenericLifetimeLifetimeTypeAT < ' static , ( ) , AssocTy =( ) > > ;
286
+ //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
287
+ //~| HELP add missing lifetime argument
288
+ }
115
289
}
116
290
117
291
mod stdlib {
@@ -135,6 +309,10 @@ mod stdlib {
135
309
type D = HashMap < usize , String , char , f64 > ;
136
310
//~^ ERROR this struct takes at most 3
137
311
//~| HELP remove this
312
+
313
+ type E = HashMap < > ;
314
+ //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
315
+ //~| HELP add missing
138
316
}
139
317
140
318
mod result {
@@ -155,6 +333,10 @@ mod stdlib {
155
333
type D = Result < usize , String , char > ;
156
334
//~^ ERROR this enum takes 2 generic arguments but 3 generic arguments
157
335
//~| HELP remove
336
+
337
+ type E = Result < > ;
338
+ //~^ ERROR this enum takes 2 generic arguments but 0 generic arguments
339
+ //~| HELP add missing
158
340
}
159
341
}
160
342
0 commit comments