[Bug][move-compiler-v2] Function-valued argument type error message is confusing #14681
Labels
bug
Something isn't working
compiler-errormessage
compiler-v2-stable
compiler-v2
stale-exempt
Prevents issues from being automatically marked and closed as stale
🐛 Bug
yields the error message:
Which is very confusing. The problem here is that
action
is|&mut T|&mut T
.|&mut T|&T
or|&T|&T
.|&mut T|&T
with|&mut T|&mut T
and finds that thereturn type
&T
is not compatible with&mut T
.&mut
" is wrong: it takes a function value with result type&mut
.&
was provided: rather, a function value with result type&
was provided.For the parameter type of the function-valued parameter, it's difficult to engineer a similar situation without PR #14254, which adds type declarations for lambda parameters.
But changing the test case to
leads to the more reasonable error message:
which would be better for the result case.
The text was updated successfully, but these errors were encountered: