1
Fork 0

Account for comma in suggestion

This commit is contained in:
Esteban Küber 2018-05-30 11:04:39 -07:00
parent cbc70a0d68
commit d66d35bb91
3 changed files with 4 additions and 4 deletions

View file

@ -3868,7 +3868,7 @@ impl<'a> Parser<'a> {
"move the `..` to the end of the field list", "move the `..` to the end of the field list",
vec![ vec![
(etc_span, "".into()), (etc_span, "".into()),
(self.span, ", .. }".into()), (self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })),
], ],
); );
} }

View file

@ -13,7 +13,7 @@
fn main() { fn main() {
struct Foo { x: isize } struct Foo { x: isize }
match (Foo { x: 10 }) { match (Foo { x: 10 }) {
Foo { ref x: ref x } => {}, //~ ERROR expected `,`, found `:` Foo { ref x: ref x } => {}, //~ ERROR expected `,`
_ => {} _ => {}
} }
} }

View file

@ -8,8 +8,8 @@ LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,`
| `..` must be at the end and cannot have a trailing comma | `..` must be at the end and cannot have a trailing comma
help: move the `..` to the end of the field list 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 `,` error: expected `}`, found `,`
--> $DIR/issue-49257.rs:21:19 --> $DIR/issue-49257.rs:21:19