blob: 6960af72c76403589200d1ec740458390762c909 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
trait A<T> { }
struct B<'a, T:'a>(&'a (dyn A<T> + 'a));
trait X { }
impl<'a, T> X for B<'a, T> {}
fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
Box::new(B(&*v)) as Box<dyn X>
//~^ ERROR lifetime may not live long enough
//~| ERROR cannot return value referencing local data `*v` [E0515]
}
fn main() { }
|