about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/auxiliary/fancy-panic.rs6
-rw-r--r--src/test/ui/panic-brace.rs6
-rw-r--r--src/test/ui/panic-brace.stderr24
3 files changed, 28 insertions, 8 deletions
diff --git a/src/test/ui/auxiliary/fancy-panic.rs b/src/test/ui/auxiliary/fancy-panic.rs
new file mode 100644
index 00000000000..e5a25a171fb
--- /dev/null
+++ b/src/test/ui/auxiliary/fancy-panic.rs
@@ -0,0 +1,6 @@
+#[macro_export]
+macro_rules! fancy_panic {
+    ($msg:expr) => {
+        panic!($msg)
+    };
+}
diff --git a/src/test/ui/panic-brace.rs b/src/test/ui/panic-brace.rs
index e3ea7a8bf0f..754dcc287d0 100644
--- a/src/test/ui/panic-brace.rs
+++ b/src/test/ui/panic-brace.rs
@@ -1,4 +1,7 @@
 // build-pass (FIXME(62277): should be check-pass)
+// aux-build:fancy-panic.rs
+
+extern crate fancy_panic;
 
 const C: &str = "abc {}";
 static S: &str = "{bla}";
@@ -16,6 +19,9 @@ fn main() {
     panic!(concat!("{", "}")); //~ WARN panic message contains an unused formatting placeholder
     panic!(concat!("{", "{")); //~ WARN panic message contains braces
 
+    fancy_panic::fancy_panic!("test {} 123");
+    //~^ WARN panic message contains an unused formatting placeholder
+
     // Check that the lint only triggers for std::panic and core::panic,
     // not any panic macro:
     macro_rules! panic {
diff --git a/src/test/ui/panic-brace.stderr b/src/test/ui/panic-brace.stderr
index 0520ab2a38f..93808891c3c 100644
--- a/src/test/ui/panic-brace.stderr
+++ b/src/test/ui/panic-brace.stderr
@@ -1,5 +1,5 @@
 warning: panic message contains a brace
-  --> $DIR/panic-brace.rs:8:29
+  --> $DIR/panic-brace.rs:11:29
    |
 LL |     panic!("here's a brace: {");
    |                             ^
@@ -12,7 +12,7 @@ LL |     panic!("{}", "here's a brace: {");
    |            ^^^^^
 
 warning: panic message contains a brace
-  --> $DIR/panic-brace.rs:9:31
+  --> $DIR/panic-brace.rs:12:31
    |
 LL |     std::panic!("another one: }");
    |                               ^
@@ -24,7 +24,7 @@ LL |     std::panic!("{}", "another one: }");
    |                 ^^^^^
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/panic-brace.rs:10:25
+  --> $DIR/panic-brace.rs:13:25
    |
 LL |     core::panic!("Hello {}");
    |                         ^^
@@ -40,7 +40,7 @@ LL |     core::panic!("{}", "Hello {}");
    |                  ^^^^^
 
 warning: panic message contains unused formatting placeholders
-  --> $DIR/panic-brace.rs:11:21
+  --> $DIR/panic-brace.rs:14:21
    |
 LL |     assert!(false, "{:03x} {test} bla");
    |                     ^^^^^^ ^^^^^^
@@ -56,7 +56,7 @@ LL |     assert!(false, "{}", "{:03x} {test} bla");
    |                    ^^^^^
 
 warning: panic message contains braces
-  --> $DIR/panic-brace.rs:13:27
+  --> $DIR/panic-brace.rs:16:27
    |
 LL |     debug_assert!(false, "{{}} bla");
    |                           ^^^^
@@ -68,7 +68,7 @@ LL |     debug_assert!(false, "{}", "{{}} bla");
    |                          ^^^^^
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/panic-brace.rs:16:12
+  --> $DIR/panic-brace.rs:19:12
    |
 LL |     panic!(concat!("{", "}"));
    |            ^^^^^^^^^^^^^^^^^
@@ -84,7 +84,7 @@ LL |     panic!("{}", concat!("{", "}"));
    |            ^^^^^
 
 warning: panic message contains braces
-  --> $DIR/panic-brace.rs:17:5
+  --> $DIR/panic-brace.rs:20:5
    |
 LL |     panic!(concat!("{", "{"));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -95,5 +95,13 @@ help: add a "{}" format string to use the message literally
 LL |     panic!("{}", concat!("{", "{"));
    |            ^^^^^
 
-warning: 7 warnings emitted
+warning: panic message contains an unused formatting placeholder
+  --> $DIR/panic-brace.rs:22:37
+   |
+LL |     fancy_panic::fancy_panic!("test {} 123");
+   |                                     ^^
+   |
+   = note: this message is not used as a format string when given without arguments, but will be in a future Rust edition
+
+warning: 8 warnings emitted