Better error messages: Tell programmer about forgotten let
#101880
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
As a python programmer, forgetting a
let
in an assignment to a variable that didn't exist before is an easy mistake to make.example code
(link to playground)
Rust sees two uses of an undefined variable here (E0425 twice):
What I would hope for
While the second one is fine, in the first case I would have really appreciated a sentence like this:
This would helped me as a newcomer to the language, because it does an educated guess what the problem might be and tells me how to fix it.
I think the hint should be added if the value is assigned to (first error), but not if it is used as an argument (second error).
I hope this is the right place and format to file this suggestion, I would appreciate hints if this is not the case.
The text was updated successfully, but these errors were encountered: