1 // Regression test for issue #24622. The older associated types code
2 // was erroneously assuming that all projections outlived the current
3 // fn body, causing this (invalid) code to be accepted.
9 impl<'a, T:'a> Foo<'a> for T {
13 fn denormalise<'a, T>(t: &'a T) -> <T as Foo<'a>>::Bar {
17 pub fn free_and_use<T: for<'a> Foo<'a>,
18 F: for<'a> FnOnce(<T as Foo<'a>>::Bar)>(x: T, f: F) {
20 'body: loop { // lifetime annotations added for clarity
21 's: loop { y = denormalise(&x); break }
22 drop(x); //~ ERROR cannot move out of `x` because it is borrowed