Include trait signature in "type annotations needed" error message. #46333
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-inference
Area: Type inference
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-diagnostics
Working group: Diagnostics
With the following code:
You will get the error message:
I can't help but feel that this is not useful, because it's not clear what
F
is.A novice user would be baffled. If we are lucky they might look at the signature of
or_else
to see ifF
is defined there. It is:I think it would be useful to include this signature in the error message, so that the user can see what
F
is without having to look it up in the docs.Indeed, this error is fixed by adding types to the
or_else
call, like so:The text was updated successfully, but these errors were encountered: