2 // ignore-compare-mode-nll
3 //[nll] compile-flags: -Z borrowck=mir
10 fn get(&self) -> T { panic!() }
13 struct B<'a, T: 'a>(&'a (A<T> + 'a));
15 trait X { fn foo(&self) {} }
17 impl<'a, T> X for B<'a, T> {}
19 fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
21 Box::new(B(&*v)) as Box<dyn X>
22 //~^ ERROR the parameter type `T` may not live long enough
23 //~| ERROR the parameter type `T` may not live long enough
24 //~| ERROR the parameter type `T` may not live long enough
25 //~| ERROR the parameter type `T` may not live long enough
26 //[base]~| ERROR the parameter type `T` may not live long enough
27 //[base]~| ERROR the parameter type `T` may not live long enough
28 //[base]~| ERROR the parameter type `T` may not live long enough
29 //[nll]~| ERROR cannot return value referencing local data `*v` [E0515]