about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/ifmt-bad-arg.rs7
-rw-r--r--src/test/ui/ifmt-bad-arg.stderr8
2 files changed, 14 insertions, 1 deletions
diff --git a/src/test/ui/ifmt-bad-arg.rs b/src/test/ui/ifmt-bad-arg.rs
index afe9bc152a3..bbd75f30d6c 100644
--- a/src/test/ui/ifmt-bad-arg.rs
+++ b/src/test/ui/ifmt-bad-arg.rs
@@ -64,4 +64,11 @@ fn main() {
     format!("foo }"); //~ ERROR: unmatched `}` found
 
     format!("foo %s baz", "bar"); //~ ERROR: argument never used
+
+    format!(r##"
+
+        {foo}
+
+    "##);
+    //~^^^ ERROR: there is no argument named `foo`
 }
diff --git a/src/test/ui/ifmt-bad-arg.stderr b/src/test/ui/ifmt-bad-arg.stderr
index 4f5f37132e8..b02aa765d09 100644
--- a/src/test/ui/ifmt-bad-arg.stderr
+++ b/src/test/ui/ifmt-bad-arg.stderr
@@ -183,5 +183,11 @@ LL |     format!("foo %s baz", "bar"); //~ ERROR: argument never used
    = help: `%s` should be written as `{}`
    = note: printf formatting not supported; see the documentation for `std::fmt`
 
-error: aborting due to 26 previous errors
+error: there is no argument named `foo`
+  --> $DIR/ifmt-bad-arg.rs:70:9
+   |
+LL |         {foo}
+   |         ^^^^^
+
+error: aborting due to 27 previous errors