Auto merge of #76160 - scileo:format-recovery, r=petrochenkov

Improve recovery on malformed format call

The token following a format expression should be a comma. However, when it is replaced with a similar token (such as a dot), then the corresponding error is emitted, but the token is treated as a comma, and the parsing step continues.

r? @petrochenkov
This commit is contained in:
bors 2020-09-02 19:29:27 +00:00
commit 365b13c0e7
2 changed files with 3 additions and 3 deletions

View file

@ -1,3 +1,3 @@
fn main() {
println!("{}" a); //~ERROR expected token: `,`
println!("{}" a); //~ERROR expected `,`, found `a`
}

View file

@ -1,7 +1,7 @@
error: expected token: `,`
error: expected `,`, found `a`
--> $DIR/issue-3145.rs:2:19
|
LL | println!("{}" a); //~ERROR expected token: `,`
LL | println!("{}" a); //~ERROR expected `,`, found `a`
| ^ expected `,`
error: aborting due to previous error