]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-89352.rs
d9c656d5f58a9e8495a2cf0b2386c4d5bd91529c
[rust.git] / src / test / ui / generic-associated-types / issue-89352.rs
1 // check-pass
2
3 #![feature(generic_associated_types)]
4
5 use std::marker::PhantomData;
6
7 pub trait GenAssoc<T> {
8     type Iter<'at>;
9     fn iter(&self) -> Self::Iter<'_>;
10     fn reborrow<'longt: 'shortt, 'shortt>(iter: Self::Iter<'longt>) -> Self::Iter<'shortt>;
11 }
12
13 pub struct Wrapper<'a, T: 'a, A: GenAssoc<T>> {
14     a: A::Iter<'a>,
15     _p: PhantomData<T>,
16 }
17
18 impl<'ai, T: 'ai, A: GenAssoc<T>> GenAssoc<T> for Wrapper<'ai, T, A>
19 where
20     A::Iter<'ai>: Clone,
21 {
22     type Iter<'b> = ();
23     fn iter<'s>(&'s self) -> Self::Iter<'s> {
24         let a = A::reborrow::<'ai, 's>(self.a.clone());
25     }
26
27     fn reborrow<'long: 'short, 'short>(iter: Self::Iter<'long>) -> Self::Iter<'short> {
28         ()
29     }
30 }
31
32 fn main() {}