Immutable variable reassignment help message #84144
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=513388a632de3de69d34c0ced0483ec6
The current output is:
Ideally the output should look like:
Maybe it's over-analyzing the messaging, but in a lot of cases we make suggestions from compiler help messages - i.e.
consider doing x
. That suggests the programmer should take a moment to think of alternatives before continuing.The current message regarding mutable variables seems quite direct, as if it might be the only solution. Perhaps in some cases it will be, but encouraging use of immutable variables is probably - generally - a good thing.
One drawback with this suggestion would be that it is less concise. That means slightly more overhead as people read and understand the message.
The text was updated successfully, but these errors were encountered: