about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-14 21:10:50 +0000
committerbors <bors@rust-lang.org>2021-03-14 21:10:50 +0000
commitd6eaea1c8860adb5302d2fbaad409e36585ab217 (patch)
tree1151d81c52c23f0a795d49992997d761a578e379 /compiler/rustc_parse/src/parser
parentbb4cdf8ec034dca5c056ec9295f38062e5b7e871 (diff)
parent0466b6ac6d2af6e9aa6cdcdde18acbf2a5056944 (diff)
downloadrust-d6eaea1c8860adb5302d2fbaad409e36585ab217.tar.gz
rust-d6eaea1c8860adb5302d2fbaad409e36585ab217.zip
Auto merge of #83062 - JohnTitor:improve-reassign-err, r=davidtwco
Improve the wording for the `can't reassign` error

Follow-up for https://github.com/rust-lang/rust/pull/71976#discussion_r448186151.
Fixes #66736
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/stmt.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs
index f6599927c6e..92e67e79291 100644
--- a/compiler/rustc_parse/src/parser/stmt.rs
+++ b/compiler/rustc_parse/src/parser/stmt.rs
@@ -291,7 +291,7 @@ impl<'a> Parser<'a> {
         Ok(P(ast::Local { ty, pat, init, id: DUMMY_NODE_ID, span: lo.to(hi), attrs, tokens: None }))
     }
 
-    /// Parses the RHS of a local variable declaration (e.g., '= 14;').
+    /// Parses the RHS of a local variable declaration (e.g., `= 14;`).
     fn parse_initializer(&mut self, eq_optional: bool) -> PResult<'a, Option<P<Expr>>> {
         let eq_consumed = match self.token.kind {
             token::BinOpEq(..) => {
@@ -306,6 +306,7 @@ impl<'a> Parser<'a> {
                     "=".to_string(),
                     Applicability::MaybeIncorrect,
                 )
+                .help("if you meant to overwrite, remove the `let` binding")
                 .emit();
                 self.bump();
                 true