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 //~ ERROR cannot infer | ^^^ | 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+'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-2.rs:10:11 | LL | box B(&*v) as Box //~ ERROR cannot infer | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: expected std::boxed::Box<(dyn X + 'static)> found std::boxed::Box error: aborting due to previous error For more information about this error, try `rustc --explain E0495`.