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
fn main() {
- println!("{}" a); //~ERROR expected token: `,`
+ println!("{}" a); //~ERROR expected `,`, found `a`
}
-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