]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-101020.rs
Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrum
[rust.git] / src / test / ui / generic-associated-types / issue-101020.rs
1 #![feature(generic_associated_types)]
2
3 pub trait LendingIterator {
4     type Item<'a>
5     where
6         Self: 'a;
7
8     fn consume<F>(self, _f: F)
9     where
10         Self: Sized,
11         for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>,
12     {
13     }
14 }
15
16 impl<I: LendingIterator + ?Sized> LendingIterator for &mut I {
17     type Item<'a> = I::Item<'a> where Self: 'a;
18 }
19 struct EmptyIter;
20 impl LendingIterator for EmptyIter {
21     type Item<'a> = &'a mut () where Self:'a;
22 }
23 pub trait FuncInput<'a, F>
24 where
25     F: Foo<Self>,
26     Self: Sized,
27 {
28 }
29 impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {}
30 trait Foo<T> {}
31
32 fn map_test() {
33     (&mut EmptyIter).consume(());
34     //~^ ERROR the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied
35 }
36
37 fn main() {}