Skip to content

Commit

Permalink
Account for comma in suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jun 5, 2018
1 parent cbc70a0 commit d66d35b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Expand Up @@ -3868,7 +3868,7 @@ impl<'a> Parser<'a> {
"move the `..` to the end of the field list",
vec![
(etc_span, "".into()),
(self.span, ", .. }".into()),
(self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/bind-struct-early-modifiers.rs
Expand Up @@ -13,7 +13,7 @@
fn main() {
struct Foo { x: isize }
match (Foo { x: 10 }) {
Foo { ref x: ref x } => {}, //~ ERROR expected `,`, found `:`
Foo { ref x: ref x } => {}, //~ ERROR expected `,`
_ => {}
}
}
4 changes: 2 additions & 2 deletions src/test/ui/issue-49257.stderr
Expand Up @@ -8,8 +8,8 @@ LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,`
| `..` must be at the end and cannot have a trailing comma
help: move the `..` to the end of the field list
|
LL | let Point { y, , .. } = p; //~ ERROR expected `}`, found `,`
| -- ^^^^^^
LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,`
| -- ^^^^

error: expected `}`, found `,`
--> $DIR/issue-49257.rs:21:19
Expand Down

0 comments on commit d66d35b

Please sign in to comment.