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