summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lifetimes/missing-lifetime-in-alias.rs
blob: af7b6412780d85aa6718e2e49fc4b5a4d9e8a26f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![feature(generic_associated_types)]

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> = <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() {}