]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs
Better errors for implied static bound
[rust.git] / src / test / ui / generic-associated-types / bugs / hrtb-implied-1.rs
1 // check-fail
2 // known-bug
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 use std::fmt::Debug;
8
9 pub trait LendingIterator {
10     type Item<'this>
11     where
12         Self: 'this;
13 }
14
15 pub struct WindowsMut<'x> {
16     slice: &'x (),
17 }
18
19 impl<'y> LendingIterator for WindowsMut<'y> {
20     type Item<'this> = &'this mut () where 'y: 'this;
21 }
22
23 fn print_items<I>(_iter: I)
24 where
25     I: LendingIterator,
26     for<'a> I::Item<'a>: Debug,
27 {
28 }
29
30 fn main() {
31     let slice = &mut ();
32     //~^ temporary value dropped while borrowed
33     let windows = WindowsMut { slice };
34     print_items::<WindowsMut<'_>>(windows);
35 }