| error[E0759]: cannot infer an appropriate lifetime |
| --> $DIR/issue-16922.rs:4:14 |
| | |
| LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> { |
| | -- this data with an anonymous lifetime `'_`... |
| LL | Box::new(value) as Box<dyn Any> |
| | ^^^^^ ...is captured here, requiring it to live as long as `'static` |
| | |
| help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound |
| | |
| LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> { |
| | ^^^^ |
| |
| error: aborting due to previous error |
| |
| For more information about this error, try `rustc --explain E0759`. |