From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/lifetimes/missing-lifetime-in-alias.rs | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/ui/lifetimes/missing-lifetime-in-alias.rs (limited to 'tests/ui/lifetimes/missing-lifetime-in-alias.rs') diff --git a/tests/ui/lifetimes/missing-lifetime-in-alias.rs b/tests/ui/lifetimes/missing-lifetime-in-alias.rs new file mode 100644 index 000000000..51c564c01 --- /dev/null +++ b/tests/ui/lifetimes/missing-lifetime-in-alias.rs @@ -0,0 +1,31 @@ +trait Trait<'a> { + type Foo; + + type Bar<'b> + //~^ NOTE associated type defined here, with 1 lifetime parameter + //~| NOTE + where + Self: 'b; +} + +struct Impl<'a>(&'a ()); + +impl<'a> Trait<'a> for Impl<'a> { + type Foo = &'a (); + type Bar<'b> = &'b (); +} + +type A<'a> = Impl<'a>; + +type B<'a> = as Trait>::Foo; +//~^ ERROR missing lifetime specifier +//~| NOTE expected named lifetime parameter + +type C<'a, 'b> = as Trait>::Bar; +//~^ ERROR missing lifetime specifier +//~| ERROR missing generics for associated type +//~| NOTE expected named lifetime parameter +//~| NOTE these named lifetimes are available to use +//~| NOTE expected 1 lifetime argument + +fn main() {} -- cgit v1.2.3