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
124 type C = Box<dyn GenericLifetime<'static, 'static>>;
125 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
128 type D = Box<dyn GenericType>;
129 //~^ ERROR missing generics for trait `GenericType`
130 //~| HELP add missing
132 type E = Box<dyn GenericType<String, usize>>;
133 //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
136 type F = Box<dyn GenericLifetime<>>;
137 //~^ ERROR missing lifetime specifier
138 //~| HELP consider introducing
140 type G = Box<dyn GenericType<>>;
141 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
142 //~| HELP add missing
145 mod associated_item {
151 type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
152 //~^ ERROR this trait takes 0 generic arguments but 1 generic argument
157 trait GenericLifetimeAT<'a> {
161 type A = Box<dyn GenericLifetimeAT<AssocTy=()>>;
162 //~^ ERROR missing lifetime specifier
163 //~| HELP consider introducing
165 type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
166 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
169 type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
170 //~^ ERROR missing lifetime specifier
171 //~| HELP consider introducing
172 //~| ERROR this trait takes 0 generic arguments but 1 generic argument
177 trait GenericTypeAT<A> {
181 type A = Box<dyn GenericTypeAT<AssocTy=()>>;
182 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
183 //~| HELP add missing
185 type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
186 //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
189 type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
190 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
191 //~| HELP add missing
192 //~| ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
196 mod lifetime_and_type {
197 trait GenericLifetimeTypeAT<'a, A> {
201 type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
202 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments
203 //~| HELP add missing
204 //~| ERROR missing lifetime specifier
205 //~| HELP consider introducing
207 type B = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
208 //~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
209 //~| HELP add missing
211 type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
212 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
214 //~| ERROR this trait takes 1 generic argument but 0 generic arguments
215 //~| HELP add missing
217 type D = Box<dyn GenericLifetimeTypeAT<(), AssocTy=()>>;
218 //~^ ERROR missing lifetime specifier
219 //~| HELP consider introducing
221 type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
222 //~^ ERROR missing lifetime specifier
223 //~| HELP consider introducing
224 //~| ERROR this trait takes 1 generic argument but 2 generic arguments
227 type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
228 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
231 type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
232 //~^ ERROR this trait takes 1 generic argument but 2 generic arguments
235 type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
236 //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
238 //~| ERROR this trait takes 1 generic argument but 2 generic arguments
243 trait GenericTypeTypeAT<A, B> {
247 type A = Box<dyn GenericTypeTypeAT<AssocTy=()>>;
248 //~^ ERROR this trait takes 2 generic arguments but 0 generic arguments
249 //~| HELP add missing
251 type B = Box<dyn GenericTypeTypeAT<(), AssocTy=()>>;
252 //~^ ERROR this trait takes 2 generic arguments but 1 generic argument
253 //~| HELP add missing
255 type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
256 //~^ ERROR this trait takes 2 generic arguments but 3 generic arguments
260 mod lifetime_and_lifetime {
261 trait GenericLifetimeLifetimeAT<'a, 'b> {
265 type A = Box<dyn GenericLifetimeLifetimeAT<AssocTy=()>>;
266 //~^ ERROR missing lifetime specifier
267 //~| HELP consider introducing
269 type B = Box<dyn GenericLifetimeLifetimeAT<'static, AssocTy=()>>;
270 //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
271 //~| HELP add missing lifetime argument
274 mod lifetime_and_lifetime_and_type {
275 trait GenericLifetimeLifetimeTypeAT<'a, 'b, A> {
279 type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
280 //~^ ERROR missing lifetime specifier
281 //~| HELP consider introducing
282 //~| ERROR this trait takes 1 generic argument but 0 generic arguments
283 //~| HELP add missing
285 type B = 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 //~| ERROR this trait takes 1 generic argument but 0 generic arguments
289 //~| HELP add missing
291 type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, (), AssocTy=()>>;
292 //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
293 //~| HELP add missing lifetime argument
299 use std::collections::HashMap;
302 //~^ ERROR missing generics for struct `HashMap`
303 //~| HELP add missing
305 type B = HashMap<String>;
306 //~^ ERROR this struct takes at least
307 //~| HELP add missing
309 type C = HashMap<'static>;
310 //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
311 //~| HELP remove these generics
312 //~| ERROR this struct takes at least 2
313 //~| HELP add missing
315 type D = HashMap<usize, String, char, f64>;
316 //~^ ERROR this struct takes at most 3
317 //~| HELP remove this
320 //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
321 //~| HELP add missing
326 //~^ ERROR missing generics for enum `Result`
327 //~| HELP add missing
329 type B = Result<String>;
330 //~^ ERROR this enum takes 2 generic arguments but 1 generic argument
331 //~| HELP add missing
333 type C = Result<'static>;
334 //~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument
335 //~| HELP remove these generics
336 //~| ERROR this enum takes 2 generic arguments but 0 generic arguments
337 //~| HELP add missing
339 type D = Result<usize, String, char>;
340 //~^ ERROR this enum takes 2 generic arguments but 3 generic arguments
344 //~^ ERROR this enum takes 2 generic arguments but 0 generic arguments
345 //~| HELP add missing