]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Check projection of an associated type out of a higher-ranked |
2 | // trait-bound in the context of a function body. | |
3 | ||
4 | pub trait Foo<T> { | |
5 | type A; | |
6 | ||
7 | fn get(&self, t: T) -> Self::A; | |
8 | } | |
9 | ||
10 | fn foo<'a, I : for<'x> Foo<&'x isize>>( | |
11 | x: <I as Foo<&'a isize>>::A) | |
12 | { | |
13 | let y: I::A = x; | |
14 | } | |
15 | ||
16 | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>( | |
17 | x: <I as Foo<&'a isize>>::A, | |
18 | y: <I as Foo<&'b isize>>::A, | |
19 | cond: bool) | |
20 | { | |
21 | // x and y here have two distinct lifetimes: | |
22 | let z: I::A = if cond { x } else { y }; | |
923072b8 FG |
23 | //~^ ERROR lifetime may not live long enough |
24 | //~| ERROR lifetime may not live long enough | |
1a4d82fc JJ |
25 | } |
26 | ||
27 | pub fn main() {} |