4 // This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for
5 // all 'a where I::Item<'a> is WF", but really means "for all 'a possible"
7 trait LendingIterator: Sized {
11 fn next(&mut self) -> Self::Item<'_>;
13 fn fails<I: LendingIterator, F>(iter: &mut I, f: F) -> bool
15 F: FnMut(I::Item<'_>),
17 let mut iter2 = Eat(iter, f);
18 let _next = iter2.next();
19 //~^ borrowed data escapes
22 impl<I: LendingIterator> LendingIterator for &mut I {
23 type Item<'a> = I::Item<'a> where Self:'a;
24 fn next(&mut self) -> Self::Item<'_> {
29 struct Eat<I, F>(I, F);
30 impl<I: LendingIterator, F> Iterator for Eat<I, F>
32 F: FnMut(I::Item<'_>),
35 fn next(&mut self) -> Option<Self::Item> {