-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Opaque error message when typechecking closure #26046
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
UPDATE: Mentoring instructions found in this comment below.
The following code fails because the closure moves out of
vec, and anything implementingFnonly gets a reference to its environment (i.e can't moveself)A simple fix that would allow the closure to properly implement
Fnis to replacevecwithvec.clone()inside the closure. The error message, however, is of no help:In cases where the closure is more complex than this trivial example, the error message is no more descriptive than above, making it much more difficult to debug.
I would like to see something more along the lines of: