summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/ty-outlives/projection-where-clause-trait.rs
blob: 1a40d3b4c2f28532a3b7cdfef0ffd89450c62f2f (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
// Test that we are able to establish that `<T as
// MyTrait<'a>>::Output: 'a` outlives `'a` (because the trait says
// so).
//
// check-pass

trait MyTrait<'a> {
    type Output: 'a;
}

fn foo<'a, T>() -> &'a ()
where
    T: MyTrait<'a>,
{
    bar::<T::Output>()
}

fn bar<'a, T>() -> &'a ()
where
    T: 'a,
{
    &()
}

fn main() {}