about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/non-fmt-panic.fixed4
-rw-r--r--src/test/ui/non-fmt-panic.rs4
-rw-r--r--src/test/ui/non-fmt-panic.stderr56
3 files changed, 60 insertions, 4 deletions
diff --git a/src/test/ui/non-fmt-panic.fixed b/src/test/ui/non-fmt-panic.fixed
index 0f55f1ae817..d226f4129aa 100644
--- a/src/test/ui/non-fmt-panic.fixed
+++ b/src/test/ui/non-fmt-panic.fixed
@@ -65,16 +65,20 @@ fn main() {
 
 fn a<T: Send + 'static>(v: T) {
     std::panic::panic_any(v); //~ WARN panic message is not a string literal
+    assert!(false, v); //~ WARN panic message is not a string literal
 }
 
 fn b<T: std::fmt::Debug + Send + 'static>(v: T) {
     std::panic::panic_any(v); //~ WARN panic message is not a string literal
+    assert!(false, "{:?}", v); //~ WARN panic message is not a string literal
 }
 
 fn c<T: std::fmt::Display + Send + 'static>(v: T) {
     std::panic::panic_any(v); //~ WARN panic message is not a string literal
+    assert!(false, "{}", v); //~ WARN panic message is not a string literal
 }
 
 fn d<T: std::fmt::Display + std::fmt::Debug + Send + 'static>(v: T) {
     std::panic::panic_any(v); //~ WARN panic message is not a string literal
+    assert!(false, "{}", v); //~ WARN panic message is not a string literal
 }
diff --git a/src/test/ui/non-fmt-panic.rs b/src/test/ui/non-fmt-panic.rs
index 6e9bdb21f0c..2ffd7638ae0 100644
--- a/src/test/ui/non-fmt-panic.rs
+++ b/src/test/ui/non-fmt-panic.rs
@@ -65,16 +65,20 @@ fn main() {
 
 fn a<T: Send + 'static>(v: T) {
     panic!(v); //~ WARN panic message is not a string literal
+    assert!(false, v); //~ WARN panic message is not a string literal
 }
 
 fn b<T: std::fmt::Debug + Send + 'static>(v: T) {
     panic!(v); //~ WARN panic message is not a string literal
+    assert!(false, v); //~ WARN panic message is not a string literal
 }
 
 fn c<T: std::fmt::Display + Send + 'static>(v: T) {
     panic!(v); //~ WARN panic message is not a string literal
+    assert!(false, v); //~ WARN panic message is not a string literal
 }
 
 fn d<T: std::fmt::Display + std::fmt::Debug + Send + 'static>(v: T) {
     panic!(v); //~ WARN panic message is not a string literal
+    assert!(false, v); //~ WARN panic message is not a string literal
 }
diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr
index 1d3346d7756..7b5e0ee324b 100644
--- a/src/test/ui/non-fmt-panic.stderr
+++ b/src/test/ui/non-fmt-panic.stderr
@@ -323,7 +323,16 @@ LL |     panic!(v);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:71:12
+  --> $DIR/non-fmt-panic.rs:68:20
+   |
+LL |     assert!(false, v);
+   |                    ^
+   |
+   = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:72:12
    |
 LL |     panic!(v);
    |            ^
@@ -340,7 +349,20 @@ LL |     std::panic::panic_any(v);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:75:12
+  --> $DIR/non-fmt-panic.rs:73:20
+   |
+LL |     assert!(false, v);
+   |                    ^
+   |
+   = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+help: add a "{:?}" format string to use the Debug implementation of `T`
+   |
+LL |     assert!(false, "{:?}", v);
+   |                    +++++++
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:77:12
    |
 LL |     panic!(v);
    |            ^
@@ -357,7 +379,20 @@ LL |     std::panic::panic_any(v);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:79:12
+  --> $DIR/non-fmt-panic.rs:78:20
+   |
+LL |     assert!(false, v);
+   |                    ^
+   |
+   = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+help: add a "{}" format string to Display the message
+   |
+LL |     assert!(false, "{}", v);
+   |                    +++++
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:82:12
    |
 LL |     panic!(v);
    |            ^
@@ -373,5 +408,18 @@ help: or use std::panic::panic_any instead
 LL |     std::panic::panic_any(v);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
-warning: 26 warnings emitted
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:83:20
+   |
+LL |     assert!(false, v);
+   |                    ^
+   |
+   = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+help: add a "{}" format string to Display the message
+   |
+LL |     assert!(false, "{}", v);
+   |                    +++++
+
+warning: 30 warnings emitted