blob: 28873ab807f8d7bcff4eb1068232875e7384a14b [file] [log] [blame]
error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
--> $DIR/regions-close-object-into-object-2.rs:10:11
|
LL | box B(&*v) as Box<dyn X>
| ^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 9:6...
--> $DIR/regions-close-object-into-object-2.rs:9:6
|
LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
| ^^
note: ...so that the type `(dyn A<T> + 'a)` is not borrowed for too long
--> $DIR/regions-close-object-into-object-2.rs:10:11
|
LL | box B(&*v) as Box<dyn X>
| ^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the expression is assignable
--> $DIR/regions-close-object-into-object-2.rs:10:5
|
LL | box B(&*v) as Box<dyn X>
| ^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected `std::boxed::Box<(dyn X + 'static)>`
found `std::boxed::Box<dyn X>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0495`.