Suggestion to make a binding mutable could lead beginners astray #118596
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
In the original code, it's unclear whether the intention is to modify the contents of
y
or only the copy contained inx
. The suggestion assumes the second case, which gives:This doesn't modify
y
yet compiles fine, which I expect could be surprising to a beginner. This meaning ofmut
is far from obvious. With the updated error message, subsequent errors guide the user to actually modifyingy
.Other cases
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: