Invalid suggestion to add dyn to something that is not a trait #139174
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-trait-objects
Area: trait objects, vtable layout
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
D-verbose
Diagnostics: Too much output caused by a single piece of incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Not suggesting
dyn
would be a good start, suggesting to move>
to the left would be even betterRationale and extra context
Let's start with some valid code (lifetime is redundant here, but makes sense in my full code).
And change it to the value produced is
Optional
:This works:
But imagine making a typo...
Error message is confusing and suggestion is wrong.
Other cases
Nightly suggests to add a parameter for a closure that takes no parameters... In addition to suggesting to adding
dyn
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: