Skip to content

Commit d66d35b

Browse files
committed
Account for comma in suggestion
1 parent cbc70a0 commit d66d35b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3868,7 +3868,7 @@ impl<'a> Parser<'a> {
38683868
"move the `..` to the end of the field list",
38693869
vec![
38703870
(etc_span, "".into()),
3871-
(self.span, ", .. }".into()),
3871+
(self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })),
38723872
],
38733873
);
38743874
}

src/test/parse-fail/bind-struct-early-modifiers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
fn main() {
1414
struct Foo { x: isize }
1515
match (Foo { x: 10 }) {
16-
Foo { ref x: ref x } => {}, //~ ERROR expected `,`, found `:`
16+
Foo { ref x: ref x } => {}, //~ ERROR expected `,`
1717
_ => {}
1818
}
1919
}

src/test/ui/issue-49257.stderr

+2-2
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

0 commit comments

Comments
 (0)