blob: 02d33aae023ff27f5c31f28e7b6edfd267523943 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
error: cannot infer an appropriate lifetime
--> $DIR/issue-16922.rs:4:14
|
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
| -- data with this lifetime...
LL | Box::new(value) as Box<dyn Any>
| ---------^^^^^-
| | |
| | ...and is captured here
| ...is required to be `'static` by this...
|
help: to permit non-static references in a `dyn Trait` value, you can add an explicit bound for the anonymous lifetime #1 defined on the function body at 3:1
|
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> {
| ^^^^
error: aborting due to previous error
|