Nonsensical suggestion when trying to move value in 'for' expression into closure #64559
Labels
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This code:
gives the following error:
Rust suggests writing
&||
to avoid borrowing. This suggestion is completely wrong - it isorig
that should be borrowed (i.e.&orig
). Attempting to follow the suggestion might lead a user to writelet _closure = &|| orig;
, which is still wrong.Rust should properly suggest
&orig
in this scenario.The text was updated successfully, but these errors were encountered: