Closure error messages should explain how the return type got inferred #78193
Labels
A-closures
Area: Closures (`|…| { … }`)
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
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:
produces the following error message:
The message doesn't explain why an integer was expected here. If the user doesn't explicitly annotate the return type of the closure, we should point to the expression that caused the return type to get inferred to begin with.
The text was updated successfully, but these errors were encountered: