Closed
Description
rust/src/test/ui/issues/issue-16922.rs
Lines 1 to 6 in f7a1f97
we currently output
rust/src/test/ui/issues/issue-16922.stderr
Lines 1 to 12 in f7a1f97
The suggestion is incomplete and will not result in compilable code. Because the lifetime is coming from an argument of type T
, which is an unconstrained type parameter, T
itself will not have the needed lifetime and causes the 'static
obligation that we're trying to reverse by suggesting '_
. The appropriate changes to the code would be either fn foo<'a, T: Any + 'a>(value: &'a T) -> Box<dyn Any + 'a>
or fn foo(value: &dyn Any) -> Box<dyn Any + '_>
, depending on whether T
appears in any other argument or not.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.