Confusing error message when trying to use a lifetime on an Any
trait object
#83325
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
A-trait-objects
Area: trait objects, vtable layout
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code playground link
Outputs an error message related to lifetime issues that is not clear what the issue exactly is.
This error is caused by
trait Any: 'static
, however this error message is not clear as to why the lifetime needs to outlive the static lifetime. Ideally the error message would say where the requirement comes from, like other lifetime-related errors.cc @estebank who was looking for weird and unintuitive errors. This wasn't caused by a crate specifically, but it still isn't a good error.
The text was updated successfully, but these errors were encountered: