Static lifetime requirement in boxed trait object (Box<dyn Trait>
) is not clearly explained
#116765
Labels
A-borrow-checker
Area: The borrow checker
A-diagnostics
Area: Messages for errors, warnings, and lints
A-dyn-trait
Area: trait objects, vtable layout
A-lifetimes
Area: Lifetimes / regions
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.
Code
Current output
Desired output
Rationale and extra context
I think it's not obvious that a boxed trait object means that there is a default lifetime requirement of
'static
, and I've spent too much time looking for where the'static
requirement comes from. Would be great to get a hint from the compiler.Other cases
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: