Cast error doesn't suggest boxed traits but maybe it should. #44602
Labels
A-coercions
Area: implicit and explicit `expr as Type` coercions
A-diagnostics
Area: Messages for errors, warnings, and lints
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I have a function call that's something like:
The first
&_
is interpreted as a no-op cast, and the second is interpreted as a&String -> &&str
. I did this to try and get a list of boxed traits, but the error message is pretty misleading unless you notice what the compiler's actually inferring, and almost makes it sound likeas
can't be used in this situation at all:I don't know how, but it would be nice if it could automagically recommend boxed traits in similar situations.
Playground
The text was updated successfully, but these errors were encountered: