Recover from using ;
as separator between fields
This commit is contained in:
parent
6e4a9ab650
commit
fbf11cfc13
5 changed files with 59 additions and 3 deletions
|
@ -1526,6 +1526,17 @@ impl<'a> Parser<'a> {
|
|||
if self.token == token::Comma {
|
||||
seen_comma = true;
|
||||
}
|
||||
if self.eat(&token::Semi) {
|
||||
let sp = self.prev_token.span;
|
||||
let mut err = self.struct_span_err(sp, format!("{adt_ty} fields are separated by `,`"));
|
||||
err.span_suggestion_short(
|
||||
sp,
|
||||
"replace `;` with `,`",
|
||||
",",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
return Err(err);
|
||||
}
|
||||
match self.token.kind {
|
||||
token::Comma => {
|
||||
self.bump();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue