2021-12-27 22:10:59 +00:00
|
|
|
trait Trait<'a> {
|
|
|
|
type Foo;
|
|
|
|
|
|
|
|
type Bar<'b>
|
|
|
|
//~^ NOTE associated type defined here, with 1 lifetime parameter
|
|
|
|
//~| NOTE
|
2023-10-31 13:45:26 +00:00
|
|
|
//~| NOTE
|
2021-12-27 22:10:59 +00:00
|
|
|
where
|
|
|
|
Self: 'b;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Impl<'a>(&'a ());
|
|
|
|
|
|
|
|
impl<'a> Trait<'a> for Impl<'a> {
|
|
|
|
type Foo = &'a ();
|
|
|
|
type Bar<'b> = &'b ();
|
2023-10-31 13:45:26 +00:00
|
|
|
//~^ ERROR: does not fulfill the required lifetime
|
|
|
|
//~| NOTE: type must outlive the lifetime `'b`
|
2021-12-27 22:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type A<'a> = Impl<'a>;
|
|
|
|
|
|
|
|
type B<'a> = <A<'a> as Trait>::Foo;
|
|
|
|
//~^ ERROR missing lifetime specifier
|
|
|
|
//~| NOTE expected named lifetime parameter
|
|
|
|
|
|
|
|
type C<'a, 'b> = <A<'a> 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() {}
|