Improve error message when coercing closures fails #72457
Labels
A-closures
Area: Closures (`|…| { … }`)
A-coercions
Area: implicit and explicit `expr as Type` coercions
A-diagnostics
Area: Messages for errors, warnings, and lints
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.
After #71599, coercing
(FnDef | Closure) x (FnDef | Closure)
is possible. It fails when one of them is capturing closure. But currently the error message is not that good.For example:
Emits:
We actually can hint user to use non-capturing closure here.
This is related to #71895
The text was updated successfully, but these errors were encountered: