about summary refs log tree commit diff
path: root/src/test/ui/macros
diff options
context:
space:
mode:
authorAndy Russell <arussell123@gmail.com>2019-01-11 12:40:05 -0500
committerAndy Russell <arussell123@gmail.com>2019-01-11 13:00:44 -0500
commit020e1f5b60d406524599bff35b43167f2af4302f (patch)
treecc5da22bf157c57f487c8dd812a41ca8ec09420c /src/test/ui/macros
parent6ecad338381cc3b8d56e2df22e5971a598eddd6c (diff)
downloadrust-020e1f5b60d406524599bff35b43167f2af4302f.tar.gz
rust-020e1f5b60d406524599bff35b43167f2af4302f.zip
don't unwrap unexpected tokens in `format!`
Fixes #57512.
Diffstat (limited to 'src/test/ui/macros')
-rw-r--r--src/test/ui/macros/format-parse-errors.rs1
-rw-r--r--src/test/ui/macros/format-parse-errors.stderr14
2 files changed, 11 insertions, 4 deletions
diff --git a/src/test/ui/macros/format-parse-errors.rs b/src/test/ui/macros/format-parse-errors.rs
index ba1e441fe33..96aee5e6aee 100644
--- a/src/test/ui/macros/format-parse-errors.rs
+++ b/src/test/ui/macros/format-parse-errors.rs
@@ -2,6 +2,7 @@ fn main() {
     format!(); //~ ERROR requires at least a format string argument
     format!(struct); //~ ERROR expected expression
     format!("s", name =); //~ ERROR expected expression
+    format!("s", foo = foo, bar); //~ ERROR expected `=`
     format!("s", foo = struct); //~ ERROR expected expression
     format!("s", struct); //~ ERROR expected expression
 
diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr
index 0463c548901..a3d2786bce1 100644
--- a/src/test/ui/macros/format-parse-errors.stderr
+++ b/src/test/ui/macros/format-parse-errors.stderr
@@ -18,20 +18,26 @@ error: expected expression, found `<eof>`
 LL |     format!("s", name =); //~ ERROR expected expression
    |                       ^ expected expression
 
+error: expected `=`, found `<eof>`
+  --> $DIR/format-parse-errors.rs:5:29
+   |
+LL |     format!("s", foo = foo, bar); //~ ERROR expected `=`
+   |                             ^^^ expected `=`
+
 error: expected expression, found keyword `struct`
-  --> $DIR/format-parse-errors.rs:5:24
+  --> $DIR/format-parse-errors.rs:6:24
    |
 LL |     format!("s", foo = struct); //~ ERROR expected expression
    |                        ^^^^^^ expected expression
 
 error: expected expression, found keyword `struct`
-  --> $DIR/format-parse-errors.rs:6:18
+  --> $DIR/format-parse-errors.rs:7:18
    |
 LL |     format!("s", struct); //~ ERROR expected expression
    |                  ^^^^^^ expected expression
 
 error: format argument must be a string literal
-  --> $DIR/format-parse-errors.rs:9:13
+  --> $DIR/format-parse-errors.rs:10:13
    |
 LL |     format!(123); //~ ERROR format argument must be a string literal
    |             ^^^
@@ -40,5 +46,5 @@ help: you might be missing a string literal to format with
 LL |     format!("{}", 123); //~ ERROR format argument must be a string literal
    |             ^^^^^
 
-error: aborting due to 6 previous errors
+error: aborting due to 7 previous errors