Reduce verbosity of suggestion message and mention lifetime in label

This commit is contained in:
Esteban Küber 2020-05-29 18:59:42 -07:00
parent 4e90f177cc
commit 921f35fe73
14 changed files with 96 additions and 87 deletions

View file

@ -2,14 +2,14 @@ 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...
| -- this data with the anonymous 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 trait object value, you can add an explicit bound for the anonymous lifetime #1 defined on the function body at 3:1
help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
|
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> {
| ^^^^