More explanatory error when calling a closure via &
#15506
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
&
#15506
When calling a closure behind a shared reference the error reported is simply "closure invocation in a
&
reference". When I first encountered this I had no idea what the problem was or how to fix it. Simply mentioning that closures behind a reference can only be called via&mut
would help.Test case:
Error:
The text was updated successfully, but these errors were encountered: