Confusing 'implicit copy' warnings when copying into heap closures without a capture clause #2942
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone
One of my teammates during ICFP (#2928) who didn't already know Rust was boggled by a particularly insistent warning.
Rustc was really complaining that v was being copied into a heap closure. The code looked like this:
The solution was to write
copy v
in the capture clause.Perhaps the warning message could be more informative? Could it hint that the copy comes from building the heap closure, and suggest writing a capture clause?
The text was updated successfully, but these errors were encountered: