]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #76160 - scileo:format-recovery, r=petrochenkov
authorbors <bors@rust-lang.org>
Wed, 2 Sep 2020 19:29:27 +0000 (19:29 +0000)
committerbors <bors@rust-lang.org>
Wed, 2 Sep 2020 19:29:27 +0000 (19:29 +0000)
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

tests/ui/issue-3145.rs
tests/ui/issue-3145.stderr

index f497d5550af5f9cb9e6fdcafb18557db5a022b2a..586d13647d15eb94fe5cc580eb497794e01bb62a 100644 (file)
@@ -1,3 +1,3 @@
 fn main() {
-    println!("{}" a); //~ERROR expected token: `,`
+    println!("{}" a); //~ERROR expected `,`, found `a`
 }
index cb0d95f5e2643abab2cce9fb77323c2acd0c3778..a35032aa150dc96238b656957921e6688c55cbff 100644 (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