Skip to content

Commit 3b64f86

Browse files
Rollup merge of #56330 - estebank:cleanup-span, r=zackmdavis
Clean up span in non-trailing `..` suggestion
2 parents 1fe2085 + 66a2c39 commit 3b64f86

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
@@ -3952,7 +3952,7 @@ impl<'a> Parser<'a> {
39523952
);
39533953
err.emit();
39543954
}
3955-
self.bump(); // `..` || `...`:w
3955+
self.bump(); // `..` || `...`
39563956

39573957
if self.token == token::CloseDelim(token::Brace) {
39583958
etc_span = Some(etc_sp);
@@ -3972,7 +3972,7 @@ impl<'a> Parser<'a> {
39723972
ate_comma = true;
39733973
}
39743974

3975-
etc_span = Some(etc_sp);
3975+
etc_span = Some(etc_sp.until(self.span));
39763976
if self.token == token::CloseDelim(token::Brace) {
39773977
// If the struct looks otherwise well formed, recover and continue.
39783978
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)