diff options
Diffstat (limited to 'tests/ui/generic-associated-types/missing_lifetime_args.rs')
-rw-r--r-- | tests/ui/generic-associated-types/missing_lifetime_args.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.rs b/tests/ui/generic-associated-types/missing_lifetime_args.rs new file mode 100644 index 000000000..78def8092 --- /dev/null +++ b/tests/ui/generic-associated-types/missing_lifetime_args.rs @@ -0,0 +1,20 @@ +trait X { + type Y<'a, 'b>; +} + +struct Foo<'a, 'b, 'c> { + a: &'a u32, + b: &'b str, + c: &'c str, +} + +fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {} +//~^ ERROR missing generics for associated type + +fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} +//~^ ERROR this struct takes 3 lifetime arguments but 2 lifetime + +fn f<'a>(_arg: Foo<'a>) {} +//~^ ERROR this struct takes 3 lifetime arguments but 1 lifetime + +fn main() {} |