about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-13 21:04:25 +0100
committerGitHub <noreply@github.com>2024-11-13 21:04:25 +0100
commite6b3a55b985e2a9a0c631561b22aca4524674645 (patch)
treebdc1995f3384a6d674640e0cfe362ab2fd871079 /compiler
parenta1923b3bf990340033b3e6211ac83418a0fd41eb (diff)
parent1136bbf0668d84d2b4b09b772e33fd8532994f83 (diff)
downloadrust-e6b3a55b985e2a9a0c631561b22aca4524674645.tar.gz
rust-e6b3a55b985e2a9a0c631561b22aca4524674645.zip
Rollup merge of #132996 - clubby789:unn-let-space, r=jieyouxu
Trim extra space when suggesting removing bad `let`

Fixes #132969
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_parse/src/parser/pat.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs
index 7f114013320..3546e5b0f04 100644
--- a/compiler/rustc_parse/src/parser/pat.rs
+++ b/compiler/rustc_parse/src/parser/pat.rs
@@ -683,7 +683,9 @@ impl<'a> Parser<'a> {
             })
         {
             self.bump();
-            self.dcx().emit_err(RemoveLet { span: lo });
+            // Trim extra space after the `let`
+            let span = lo.with_hi(self.token.span.lo());
+            self.dcx().emit_err(RemoveLet { span });
             lo = self.token.span;
         }