Skip to content

Commit 431017b

Browse files
committed
avoid byte slicing in dotdotdot rest pattern suggestion
1 parent e2b66ef commit 431017b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

compiler/rustc_parse/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3238,7 +3238,7 @@ pub(crate) struct DotDotDotRestPattern {
32383238
#[suggestion(
32393239
"for a rest pattern, use `..` instead of `...`",
32403240
style = "verbose",
3241-
code = "",
3241+
code = "..",
32423242
applicability = "machine-applicable"
32433243
)]
32443244
pub suggestion: Option<Span>,

compiler/rustc_parse/src/parser/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ impl<'a> Parser<'a> {
920920
// The user probably mistook `...` for a rest pattern `..`.
921921
self.dcx().emit_err(DotDotDotRestPattern {
922922
span: lo,
923-
suggestion: Some(lo.with_lo(lo.hi() - BytePos(1))),
923+
suggestion: Some(lo),
924924
var_args: None,
925925
});
926926
PatKind::Rest

0 commit comments

Comments
 (0)