Reduce verbosity of suggestion message and mention lifetime in label
This commit is contained in:
parent
4e90f177cc
commit
921f35fe73
14 changed files with 96 additions and 87 deletions
|
|
@ -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 + '_> {
|
||||
| ^^^^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue