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