2015-03-31 23:58:01 +00:00
|
|
|
trait A<T> { }
|
2021-08-25 00:39:40 +00:00
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
struct B<'a, T:'a>(&'a (dyn A<T> + 'a));
|
2014-02-26 17:09:15 +00:00
|
|
|
|
2015-03-31 23:58:01 +00:00
|
|
|
trait X { }
|
2014-02-26 17:09:15 +00:00
|
|
|
impl<'a, T> X for B<'a, T> {}
|
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
|
2022-04-19 10:56:18 +00:00
|
|
|
Box::new(B(&*v)) as Box<dyn X>
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
//~| ERROR cannot return value referencing local data `*v` [E0515]
|
2014-02-26 17:09:15 +00:00
|
|
|
}
|
|
|
|
|
2015-02-12 14:37:52 +00:00
|
|
|
fn main() { }
|