diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2024-11-28 01:35:36 +0000 | 
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2024-11-28 01:37:01 +0000 | 
| commit | c3c68c5cb1a6a00ed90f2443d3a387dbe437d6b0 (patch) | |
| tree | 68a7b8c59a005dbd3f3edd512b526483db3d61f9 /compiler/rustc_parse/src | |
| parent | c322cd5c5ac13b5ef16a487c889f8c148d8e3841 (diff) | |
| download | rust-c3c68c5cb1a6a00ed90f2443d3a387dbe437d6b0.tar.gz rust-c3c68c5cb1a6a00ed90f2443d3a387dbe437d6b0.zip | |
Trim extra space in 'repeated `mut`' diagnostic
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 | 4 | 
2 files changed, 5 insertions, 2 deletions
| diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 9bdb99dc000..315173050d7 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -2611,8 +2611,9 @@ pub(crate) enum InvalidMutInPattern { #[diag(parse_repeated_mut_in_pattern)] pub(crate) struct RepeatedMutInPattern { #[primary_span] - #[suggestion(code = "", applicability = "machine-applicable", style = "verbose")] pub span: Span, + #[suggestion(code = "", applicability = "machine-applicable", 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 004b5b34813..bb976e092bf 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1089,7 +1089,9 @@ impl<'a> Parser<'a> { return; } - self.dcx().emit_err(RepeatedMutInPattern { span: lo.to(self.prev_token.span) }); + let span = lo.to(self.prev_token.span); + let suggestion = span.with_hi(self.token.span.lo()); + self.dcx().emit_err(RepeatedMutInPattern { span, suggestion }); } /// Parse macro invocation | 
