]> git.proxmox.com Git - rustc.git/blame - src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / associated-types / associated-types-project-from-hrtb-in-fn-body.rs
CommitLineData
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
4pub trait Foo<T> {
5 type A;
6
7 fn get(&self, t: T) -> Self::A;
8}
9
10fn 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
16fn 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
27pub fn main() {}