diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-11-17 23:56:09 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-17 23:56:09 +0800 |
| commit | 0b157e88d7cf021c0ac537c4618b873f962772ac (patch) | |
| tree | c552ab1797a16630e2f4b4a343949c93374f67fa /compiler/rustc_parse/src | |
| parent | 2f62fd3d137395ffd7f31fdb7da3c61d70f1ba54 (diff) | |
| parent | dd557c988f63ae000d56ced1ce52c86c507a47e3 (diff) | |
| download | rust-0b157e88d7cf021c0ac537c4618b873f962772ac.tar.gz rust-0b157e88d7cf021c0ac537c4618b873f962772ac.zip | |
Rollup merge of #133060 - tyrone-wu:removelet-span-suggestion, r=jieyouxu
Trim whitespace in RemoveLet primary span Separate `RemoveLet` span into primary span for `let` and removal suggestion span for `let `, so that primary span does not include whitespace. Fixes: #133031
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 7ec4ad6dc35..37eb463cba6 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -650,8 +650,9 @@ pub(crate) struct LeftArrowOperator { #[diag(parse_remove_let)] pub(crate) struct RemoveLet { #[primary_span] - #[suggestion(applicability = "machine-applicable", code = "", style = "verbose")] pub span: Span, + #[suggestion(applicability = "machine-applicable", code = "", style = "verbose")] + pub suggestion: Span, } #[derive(Diagnostic)] diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 3546e5b0f04..c4326427f67 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -685,7 +685,7 @@ impl<'a> Parser<'a> { self.bump(); // Trim extra space after the `let` let span = lo.with_hi(self.token.span.lo()); - self.dcx().emit_err(RemoveLet { span }); + self.dcx().emit_err(RemoveLet { span: lo, suggestion: span }); lo = self.token.span; } |
