]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/bugs/hrtb-implied-2.rs
Fix known-bug, silence ICE stderr
[rust.git] / tests / ui / generic-associated-types / bugs / hrtb-implied-2.rs
1 // check-fail
2 // known-bug: unknown
3
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"
6
7 trait LendingIterator: Sized {
8     type Item<'a>
9     where
10         Self: 'a;
11     fn next(&mut self) -> Self::Item<'_>;
12 }
13 fn fails<I: LendingIterator, F>(iter: &mut I, f: F) -> bool
14 where
15     F: FnMut(I::Item<'_>),
16 {
17     let mut iter2 = Eat(iter, f);
18     let _next = iter2.next();
19     true
20 }
21 impl<I: LendingIterator> LendingIterator for &mut I {
22     type Item<'a> = I::Item<'a> where Self:'a;
23     fn next(&mut self) -> Self::Item<'_> {
24         (**self).next()
25     }
26 }
27
28 struct Eat<I, F>(I, F);
29 impl<I: LendingIterator, F> Iterator for Eat<I, F>
30 where
31     F: FnMut(I::Item<'_>),
32 {
33     type Item = ();
34     fn next(&mut self) -> Option<Self::Item> {
35         None
36     }
37 }
38
39 fn main() {}