blob: ddf168ffd106b8d76553cb3ce6308df78f5ad5bf [file] [log] [blame]
error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/regions-close-object-into-object-2.rs:13:16
|
LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
| ------------------ this data with lifetime `'a`...
LL | Box::new(B(&*v)) as Box<dyn X>
| ^^^ ...is used and required to live as long as `'static` here
|
note: `'static` lifetime requirement introduced by the return type
--> $DIR/regions-close-object-into-object-2.rs:12:60
|
LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
| ^^^^^^^ `'static` requirement introduced here
LL | Box::new(B(&*v)) as Box<dyn X>
| ------------------------------ because of this returned expression
help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v`
|
LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> {
| ~~
help: alternatively, add an explicit `'static` bound to this reference
|
LL | fn g<'a, T: 'static>(v: Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> {
| ~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
For more information about this error, try `rustc --explain E0759`.