7 //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
8 //~| HELP remove these generics
10 type C = Ty<'static, usize>;
11 //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
12 //~| ERROR this struct takes 0 generic arguments but 1 generic argument
13 //~| HELP remove this lifetime argument
14 //~| HELP remove this generic argument
16 type D = Ty<'static, usize, { 0 }>;
17 //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
18 //~| ERROR this struct takes 0 generic arguments but 2 generic arguments
19 //~| HELP remove this lifetime argument
20 //~| HELP remove these generic arguments
27 //~^ ERROR missing generics for struct `type_and_type::Ty`
31 //~^ ERROR this struct takes 2 generic arguments but 1 generic argument
34 type C = Ty<usize, String>;
36 type D = Ty<usize, String, char>;
37 //~^ ERROR this struct takes 2 generic arguments but 3 generic arguments
41 //~^ ERROR this struct takes 2 generic arguments but 0 generic arguments were supplied
45 mod lifetime_and_type {
49 //~^ ERROR missing generics for struct
50 //~| ERROR missing lifetime specifier
52 //~| HELP consider introducing
55 //~^ ERROR this struct takes 1 generic argument but 0 generic arguments
59 //~^ ERROR missing lifetime specifier
60 //~| HELP consider introducing
62 type D = Ty<'static, usize>;
65 //~^ ERROR this struct takes 1 generic argument but 0 generic arguments
66 //~| ERROR missing lifetime specifier
67 //~| HELP consider introducing
70 type F = Ty<'static, usize, 'static, usize>;
71 //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments
72 //~| ERROR this struct takes 1 generic argument but 2 generic arguments
73 //~| HELP remove this lifetime argument
74 //~| HELP remove this generic argument
77 mod type_and_type_and_type {
78 struct Ty<A, B, C = &'static str>;
81 //~^ ERROR missing generics for struct `type_and_type_and_type::Ty`
85 //~^ ERROR this struct takes at least 2
88 type C = Ty<usize, String>;
90 type D = Ty<usize, String, char>;
92 type E = Ty<usize, String, char, f64>;
93 //~^ ERROR this struct takes at most 3
97 //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
101 // Traits have an implicit `Self` type - these tests ensure we don't accidentally return it
102 // somewhere in the message
108 trait GenericLifetime<'a> {
112 trait GenericType<A> {
116 type A = Box<dyn NonGeneric<usize>>;
117 //~^ ERROR this trait takes 0 generic arguments but 1 generic argument
120 type B = Box<dyn GenericLifetime>;
121 //~^ ERROR missing lifetime specifier
122 //~| HELP consider introducing
123 //~| HELP consider making the bound lifetime-generic
125 type C = Box<dyn GenericLifetime<'static, 'static>>;
126 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
129 type D = Box<dyn GenericType>;
130 //~^ ERROR missing generics for trait `GenericType`
131 //~| HELP add missing
133 type E = Box<dyn GenericType<String, usize>>;
134 //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
137 type F = Box<dyn GenericLifetime<>>;
138 //~^ ERROR missing lifetime specifier
139 //~| HELP consider introducing
140 //~| HELP consider making the bound lifetime-generic
142 type G = Box<dyn GenericType<>>;
143 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
144 //~| HELP add missing
147 mod associated_item {
153 type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
154 //~^ ERROR this trait takes 0 generic arguments but 1 generic argument
159 trait GenericLifetimeAT<'a> {
163 type A = Box<dyn GenericLifetimeAT<AssocTy=()>>;
164 //~^ ERROR missing lifetime specifier
165 //~| HELP consider introducing
166 //~| HELP consider making the bound lifetime-generic
168 type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
169 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
172 type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
173 //~^ ERROR missing lifetime specifier
174 //~| HELP consider introducing
175 //~| HELP consider making the bound lifetime-generic
176 //~| ERROR this trait takes 0 generic arguments but 1 generic argument
181 trait GenericTypeAT<A> {
185 type A = Box<dyn GenericTypeAT<AssocTy=()>>;
186 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
187 //~| HELP add missing
189 type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
190 //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
193 type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
194 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
195 //~| HELP add missing
196 //~| ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
200 mod lifetime_and_type {
201 trait GenericLifetimeTypeAT<'a, A> {
205 type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
206 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
207 //~| HELP add missing
208 //~| ERROR missing lifetime specifier
209 //~| HELP consider introducing
210 //~| HELP consider making the bound lifetime-generic
212 type B = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
213 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
214 //~| HELP add missing
216 type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
217 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
219 //~| ERROR this trait takes 1 generic argument but 0 generic arguments
220 //~| HELP add missing
222 type D = Box<dyn GenericLifetimeTypeAT<(), AssocTy=()>>;
223 //~^ ERROR missing lifetime specifier
224 //~| HELP consider introducing
225 //~| HELP consider making the bound lifetime-generic
227 type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
228 //~^ ERROR missing lifetime specifier
229 //~| HELP consider introducing
230 //~| HELP consider making the bound lifetime-generic
231 //~| ERROR this trait takes 1 generic argument but 2 generic arguments
234 type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
235 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
238 type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
239 //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
242 type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
243 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
245 //~| ERROR this trait takes 1 generic argument but 2 generic arguments
250 trait GenericTypeTypeAT<A, B> {
254 type A = Box<dyn GenericTypeTypeAT<AssocTy=()>>;
255 //~^ ERROR this trait takes 2 generic arguments but 0 generic arguments
256 //~| HELP add missing
258 type B = Box<dyn GenericTypeTypeAT<(), AssocTy=()>>;
259 //~^ ERROR this trait takes 2 generic arguments but 1 generic argument
260 //~| HELP add missing
262 type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
263 //~^ ERROR this trait takes 2 generic arguments but 3 generic arguments
267 mod lifetime_and_lifetime {
268 trait GenericLifetimeLifetimeAT<'a, 'b> {
272 type A = Box<dyn GenericLifetimeLifetimeAT<AssocTy=()>>;
273 //~^ ERROR missing lifetime specifier
274 //~| HELP consider introducing
275 //~| HELP consider making the bound lifetime-generic
277 type B = Box<dyn GenericLifetimeLifetimeAT<'static, AssocTy=()>>;
278 //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
279 //~| HELP add missing lifetime argument
282 mod lifetime_and_lifetime_and_type {
283 trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
287 type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
288 //~^ ERROR missing lifetime specifier
289 //~| HELP consider introducing
290 //~| HELP consider making the bound lifetime-generic
291 //~| ERROR this trait takes 1 generic argument but 0 generic arguments
292 //~| HELP add missing
294 type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
295 //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
296 //~| HELP add missing lifetime argument
297 //~| ERROR this trait takes 1 generic argument but 0 generic arguments
298 //~| HELP add missing
300 type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, (), AssocTy=()>>;
301 //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
302 //~| HELP add missing lifetime argument
308 use std::collections::HashMap;
311 //~^ ERROR missing generics for struct `HashMap`
312 //~| HELP add missing
314 type B = HashMap<String>;
315 //~^ ERROR this struct takes at least
316 //~| HELP add missing
318 type C = HashMap<'static>;
319 //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
320 //~| HELP remove these generics
321 //~| ERROR this struct takes at least 2
322 //~| HELP add missing
324 type D = HashMap<usize, String, char, f64>;
325 //~^ ERROR this struct takes at most 3
326 //~| HELP remove this
329 //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
330 //~| HELP add missing
335 //~^ ERROR missing generics for enum `Result`
336 //~| HELP add missing
338 type B = Result<String>;
339 //~^ ERROR this enum takes 2 generic arguments but 1 generic argument
340 //~| HELP add missing
342 type C = Result<'static>;
343 //~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument
344 //~| HELP remove these generics
345 //~| ERROR this enum takes 2 generic arguments but 0 generic arguments
346 //~| HELP add missing
348 type D = Result<usize, String, char>;
349 //~^ ERROR this enum takes 2 generic arguments but 3 generic arguments
353 //~^ ERROR this enum takes 2 generic arguments but 0 generic arguments
354 //~| HELP add missing