1 // Test that we can deduce when projections like `T::Item` outlive the
2 // function body. Test that this does not imply that `T: 'a` holds.
4 // compile-flags:-Zverbose
8 fn twice<F, T>(mut value: T, mut f: F)
10 F: FnMut(&T, Cell<&Option<T::Item>>),
13 let mut n = value.next();
14 f(&value, Cell::new(&n));
15 f(&value, Cell::new(&n));
18 fn generic1<T: Iterator>(value: T) {
20 twice(value, |value_ref, item| invoke1(item));
23 fn invoke1<'a, T>(x: Cell<&'a Option<T>>)
29 fn generic2<T: Iterator>(value: T) {
30 twice(value, |value_ref, item| invoke2(value_ref, item));
31 //~^ ERROR the parameter type `T` may not live long enough
34 fn invoke2<'a, T, U>(a: &T, b: Cell<&'a Option<U>>)