about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-02 19:29:27 +0000
committerbors <bors@rust-lang.org>2020-09-02 19:29:27 +0000
commit365b13c0e71f4af148e544a9f35aa0241dc2a56e (patch)
tree81decc6c789f06e3a80e3ecac531b4c366e81401
parentfdc48fb90c04b26b03ee7d8ae85e3175e5fc538c (diff)
parent246f1f8a8eccf4d997e85ed80097f9263624c4a4 (diff)
downloadrust-365b13c0e71f4af148e544a9f35aa0241dc2a56e.tar.gz
rust-365b13c0e71f4af148e544a9f35aa0241dc2a56e.zip
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
-rw-r--r--tests/ui/issue-3145.rs2
-rw-r--r--tests/ui/issue-3145.stderr4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/ui/issue-3145.rs b/tests/ui/issue-3145.rs
index f497d5550af..586d13647d1 100644
--- a/tests/ui/issue-3145.rs
+++ b/tests/ui/issue-3145.rs
@@ -1,3 +1,3 @@
 fn main() {
-    println!("{}" a); //~ERROR expected token: `,`
+    println!("{}" a); //~ERROR expected `,`, found `a`
 }
diff --git a/tests/ui/issue-3145.stderr b/tests/ui/issue-3145.stderr
index cb0d95f5e26..a35032aa150 100644
--- a/tests/ui/issue-3145.stderr
+++ b/tests/ui/issue-3145.stderr
@@ -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