Skip to content

Commit 66a2c39

Browse files
committed
Clean up span in non-trailing .. suggestion
1 parent 423291f commit 66a2c39

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/libsyntax/parse/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3956,7 +3956,7 @@ impl<'a> Parser<'a> {
39563956
);
39573957
err.emit();
39583958
}
3959-
self.bump(); // `..` || `...`:w
3959+
self.bump(); // `..` || `...`
39603960

39613961
if self.token == token::CloseDelim(token::Brace) {
39623962
etc_span = Some(etc_sp);
@@ -3976,7 +3976,7 @@ impl<'a> Parser<'a> {
39763976
ate_comma = true;
39773977
}
39783978

3979-
etc_span = Some(etc_sp);
3979+
etc_span = Some(etc_sp.until(self.span));
39803980
if self.token == token::CloseDelim(token::Brace) {
39813981
// If the struct looks otherwise well formed, recover and continue.
39823982
if let Some(sp) = comma_sp {

src/test/ui/issues/issue-49257.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,`
88
| `..` must be at the end and cannot have a trailing comma
99
help: move the `..` to the end of the field list
1010
|
11-
LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,`
12-
| -- ^^^^
11+
LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,`
12+
| -- ^^^^
1313

1414
error: expected `}`, found `,`
1515
--> $DIR/issue-49257.rs:21:19
@@ -21,8 +21,8 @@ LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,`
2121
| `..` must be at the end and cannot have a trailing comma
2222
help: move the `..` to the end of the field list
2323
|
24-
LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,`
25-
| -- ^^^^^^
24+
LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,`
25+
| -- ^^^^^^
2626

2727
error: expected `}`, found `,`
2828
--> $DIR/issue-49257.rs:22:19

0 commit comments

Comments
 (0)