about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-02-02 00:40:17 +0100
committerMara Bos <m-ou.se@m-ou.se>2021-02-03 23:15:45 +0100
commite9ad5be0f72f012c463c7796b9620df07b78bce6 (patch)
tree7741599ac56d34e01ec3303dd98151b35f5810e5
parent34d5ac25c565a772c5974ab3b332644a9eff60f8 (diff)
downloadrust-e9ad5be0f72f012c463c7796b9620df07b78bce6.tar.gz
rust-e9ad5be0f72f012c463c7796b9620df07b78bce6.zip
Allow/fix non_fmt_panic in tests.
-rw-r--r--library/term/src/terminfo/parm/tests.rs12
-rw-r--r--library/test/src/tests.rs2
-rw-r--r--src/test/ui-fulldeps/issue-15149.rs6
-rw-r--r--src/test/ui/consts/const-eval/const_panic.rs1
-rw-r--r--src/test/ui/consts/const-eval/const_panic.stderr40
-rw-r--r--src/test/ui/drop/dynamic-drop-async.rs2
-rw-r--r--src/test/ui/drop/dynamic-drop.rs4
-rw-r--r--src/test/ui/macros/assert-macro-owned.rs2
-rw-r--r--src/test/ui/mir/mir_drop_order.rs2
-rw-r--r--src/test/ui/panics/explicit-panic-msg.rs1
-rw-r--r--src/test/ui/panics/panic-macro-any-wrapped.rs2
-rw-r--r--src/test/ui/panics/panic-macro-any.rs1
-rw-r--r--src/test/ui/panics/while-panic.rs2
13 files changed, 42 insertions, 35 deletions
diff --git a/library/term/src/terminfo/parm/tests.rs b/library/term/src/terminfo/parm/tests.rs
index b975bd2d198..1cc0967c8f4 100644
--- a/library/term/src/terminfo/parm/tests.rs
+++ b/library/term/src/terminfo/parm/tests.rs
@@ -77,15 +77,15 @@ fn test_comparison_ops() {
     for &(op, bs) in v.iter() {
         let s = format!("%{{1}}%{{2}}%{}%d", op);
         let res = expand(s.as_bytes(), &[], &mut Variables::new());
-        assert!(res.is_ok(), res.unwrap_err());
+        assert!(res.is_ok(), "{}", res.unwrap_err());
         assert_eq!(res.unwrap(), vec![b'0' + bs[0]]);
         let s = format!("%{{1}}%{{1}}%{}%d", op);
         let res = expand(s.as_bytes(), &[], &mut Variables::new());
-        assert!(res.is_ok(), res.unwrap_err());
+        assert!(res.is_ok(), "{}", res.unwrap_err());
         assert_eq!(res.unwrap(), vec![b'0' + bs[1]]);
         let s = format!("%{{2}}%{{1}}%{}%d", op);
         let res = expand(s.as_bytes(), &[], &mut Variables::new());
-        assert!(res.is_ok(), res.unwrap_err());
+        assert!(res.is_ok(), "{}", res.unwrap_err());
         assert_eq!(res.unwrap(), vec![b'0' + bs[2]]);
     }
 }
@@ -95,13 +95,13 @@ fn test_conditionals() {
     let mut vars = Variables::new();
     let s = b"\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m";
     let res = expand(s, &[Number(1)], &mut vars);
-    assert!(res.is_ok(), res.unwrap_err());
+    assert!(res.is_ok(), "{}", res.unwrap_err());
     assert_eq!(res.unwrap(), "\\E[31m".bytes().collect::<Vec<_>>());
     let res = expand(s, &[Number(8)], &mut vars);
-    assert!(res.is_ok(), res.unwrap_err());
+    assert!(res.is_ok(), "{}", res.unwrap_err());
     assert_eq!(res.unwrap(), "\\E[90m".bytes().collect::<Vec<_>>());
     let res = expand(s, &[Number(42)], &mut vars);
-    assert!(res.is_ok(), res.unwrap_err());
+    assert!(res.is_ok(), "{}", res.unwrap_err());
     assert_eq!(res.unwrap(), "\\E[38;5;42m".bytes().collect::<Vec<_>>());
 }
 
diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs
index 99e12c973c4..f0586d510db 100644
--- a/library/test/src/tests.rs
+++ b/library/test/src/tests.rs
@@ -199,7 +199,7 @@ fn test_should_panic_bad_message() {
 fn test_should_panic_non_string_message_type() {
     use crate::tests::TrFailedMsg;
     fn f() {
-        panic!(1i32);
+        std::panic::panic_any(1i32);
     }
     let expected = "foobar";
     let failed_msg = format!(
diff --git a/src/test/ui-fulldeps/issue-15149.rs b/src/test/ui-fulldeps/issue-15149.rs
index c80628aabc8..c7ef5ad70a1 100644
--- a/src/test/ui-fulldeps/issue-15149.rs
+++ b/src/test/ui-fulldeps/issue-15149.rs
@@ -50,7 +50,7 @@ fn test() {
                                                       .output().unwrap();
 
     assert!(child_output.status.success(),
-            format!("child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
-                    str::from_utf8(&child_output.stdout).unwrap(),
-                    str::from_utf8(&child_output.stderr).unwrap()));
+            "child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
+            str::from_utf8(&child_output.stdout).unwrap(),
+            str::from_utf8(&child_output.stderr).unwrap());
 }
diff --git a/src/test/ui/consts/const-eval/const_panic.rs b/src/test/ui/consts/const-eval/const_panic.rs
index e9d66477d60..8ae8376ae4a 100644
--- a/src/test/ui/consts/const-eval/const_panic.rs
+++ b/src/test/ui/consts/const-eval/const_panic.rs
@@ -1,4 +1,5 @@
 #![feature(const_panic)]
+#![allow(non_fmt_panic)]
 #![crate_type = "lib"]
 
 const MSG: &str = "hello";
diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr
index 713be5b662d..74907a0b495 100644
--- a/src/test/ui/consts/const-eval/const_panic.stderr
+++ b/src/test/ui/consts/const-eval/const_panic.stderr
@@ -1,10 +1,10 @@
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:6:15
+  --> $DIR/const_panic.rs:7:15
    |
 LL | const Z: () = std::panic!("cheese");
    | --------------^^^^^^^^^^^^^^^^^^^^^-
    |               |
-   |               the evaluated program panicked at 'cheese', $DIR/const_panic.rs:6:15
+   |               the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15
    |
    = note: `#[deny(const_err)]` on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
@@ -12,108 +12,108 @@ LL | const Z: () = std::panic!("cheese");
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:10:16
+  --> $DIR/const_panic.rs:11:16
    |
 LL | const Z2: () = std::panic!();
    | ---------------^^^^^^^^^^^^^-
    |                |
-   |                the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16
+   |                the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:11:16
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:14:15
+  --> $DIR/const_panic.rs:15:15
    |
 LL | const Y: () = std::unreachable!();
    | --------------^^^^^^^^^^^^^^^^^^^-
    |               |
-   |               the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:14:15
+   |               the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:15:15
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:18:15
+  --> $DIR/const_panic.rs:19:15
    |
 LL | const X: () = std::unimplemented!();
    | --------------^^^^^^^^^^^^^^^^^^^^^-
    |               |
-   |               the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:18:15
+   |               the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:19:15
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:22:15
+  --> $DIR/const_panic.rs:23:15
    |
 LL | const W: () = std::panic!(MSG);
    | --------------^^^^^^^^^^^^^^^^-
    |               |
-   |               the evaluated program panicked at 'hello', $DIR/const_panic.rs:22:15
+   |               the evaluated program panicked at 'hello', $DIR/const_panic.rs:23:15
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:26:20
+  --> $DIR/const_panic.rs:27:20
    |
 LL | const Z_CORE: () = core::panic!("cheese");
    | -------------------^^^^^^^^^^^^^^^^^^^^^^-
    |                    |
-   |                    the evaluated program panicked at 'cheese', $DIR/const_panic.rs:26:20
+   |                    the evaluated program panicked at 'cheese', $DIR/const_panic.rs:27:20
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:30:21
+  --> $DIR/const_panic.rs:31:21
    |
 LL | const Z2_CORE: () = core::panic!();
    | --------------------^^^^^^^^^^^^^^-
    |                     |
-   |                     the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:30:21
+   |                     the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:31:21
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:34:20
+  --> $DIR/const_panic.rs:35:20
    |
 LL | const Y_CORE: () = core::unreachable!();
    | -------------------^^^^^^^^^^^^^^^^^^^^-
    |                    |
-   |                    the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:34:20
+   |                    the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:35:20
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:38:20
+  --> $DIR/const_panic.rs:39:20
    |
 LL | const X_CORE: () = core::unimplemented!();
    | -------------------^^^^^^^^^^^^^^^^^^^^^^-
    |                    |
-   |                    the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:38:20
+   |                    the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:39:20
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
-  --> $DIR/const_panic.rs:42:20
+  --> $DIR/const_panic.rs:43:20
    |
 LL | const W_CORE: () = core::panic!(MSG);
    | -------------------^^^^^^^^^^^^^^^^^-
    |                    |
-   |                    the evaluated program panicked at 'hello', $DIR/const_panic.rs:42:20
+   |                    the evaluated program panicked at 'hello', $DIR/const_panic.rs:43:20
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
diff --git a/src/test/ui/drop/dynamic-drop-async.rs b/src/test/ui/drop/dynamic-drop-async.rs
index a952fe8e76e..cb6d58a23d9 100644
--- a/src/test/ui/drop/dynamic-drop-async.rs
+++ b/src/test/ui/drop/dynamic-drop-async.rs
@@ -82,7 +82,7 @@ impl Allocator {
         self.cur_ops.set(self.cur_ops.get() + 1);
 
         if self.cur_ops.get() == self.failing_op {
-            panic!(InjectedFailure);
+            panic::panic_any(InjectedFailure);
         }
     }
 }
diff --git a/src/test/ui/drop/dynamic-drop.rs b/src/test/ui/drop/dynamic-drop.rs
index ddccee20e12..e28bedb982d 100644
--- a/src/test/ui/drop/dynamic-drop.rs
+++ b/src/test/ui/drop/dynamic-drop.rs
@@ -46,7 +46,7 @@ impl Allocator {
         self.cur_ops.set(self.cur_ops.get() + 1);
 
         if self.cur_ops.get() == self.failing_op {
-            panic!(InjectedFailure);
+            panic::panic_any(InjectedFailure);
         }
 
         let mut data = self.data.borrow_mut();
@@ -67,7 +67,7 @@ impl<'a> Drop for Ptr<'a> {
         self.1.cur_ops.set(self.1.cur_ops.get() + 1);
 
         if self.1.cur_ops.get() == self.1.failing_op {
-            panic!(InjectedFailure);
+            panic::panic_any(InjectedFailure);
         }
     }
 }
diff --git a/src/test/ui/macros/assert-macro-owned.rs b/src/test/ui/macros/assert-macro-owned.rs
index b50fe65c015..2846f2a1f83 100644
--- a/src/test/ui/macros/assert-macro-owned.rs
+++ b/src/test/ui/macros/assert-macro-owned.rs
@@ -2,6 +2,8 @@
 // error-pattern:panicked at 'test-assert-owned'
 // ignore-emscripten no processes
 
+#![allow(non_fmt_panic)]
+
 fn main() {
     assert!(false, "test-assert-owned".to_string());
 }
diff --git a/src/test/ui/mir/mir_drop_order.rs b/src/test/ui/mir/mir_drop_order.rs
index 2949437b1e4..22c804abf5c 100644
--- a/src/test/ui/mir/mir_drop_order.rs
+++ b/src/test/ui/mir/mir_drop_order.rs
@@ -38,7 +38,7 @@ fn main() {
     assert_eq!(get(), vec![0, 2, 3, 1]);
 
     let _ = std::panic::catch_unwind(|| {
-        (d(4), &d(5), d(6), &d(7), panic!(InjectedFailure));
+        (d(4), &d(5), d(6), &d(7), panic::panic_any(InjectedFailure));
     });
 
     // here, the temporaries (5/7) live until the end of the
diff --git a/src/test/ui/panics/explicit-panic-msg.rs b/src/test/ui/panics/explicit-panic-msg.rs
index 1789e2e62c8..bfcc12cd186 100644
--- a/src/test/ui/panics/explicit-panic-msg.rs
+++ b/src/test/ui/panics/explicit-panic-msg.rs
@@ -1,5 +1,6 @@
 #![allow(unused_assignments)]
 #![allow(unused_variables)]
+#![allow(non_fmt_panic)]
 
 // run-fail
 // error-pattern:wooooo
diff --git a/src/test/ui/panics/panic-macro-any-wrapped.rs b/src/test/ui/panics/panic-macro-any-wrapped.rs
index 80c87c6f32c..95ae6ffe8be 100644
--- a/src/test/ui/panics/panic-macro-any-wrapped.rs
+++ b/src/test/ui/panics/panic-macro-any-wrapped.rs
@@ -2,6 +2,8 @@
 // error-pattern:panicked at 'Box<Any>'
 // ignore-emscripten no processes
 
+#![allow(non_fmt_panic)]
+
 fn main() {
     panic!(Box::new(612_i64));
 }
diff --git a/src/test/ui/panics/panic-macro-any.rs b/src/test/ui/panics/panic-macro-any.rs
index ffc7114c1f5..d2a7ba3713a 100644
--- a/src/test/ui/panics/panic-macro-any.rs
+++ b/src/test/ui/panics/panic-macro-any.rs
@@ -3,6 +3,7 @@
 // ignore-emscripten no processes
 
 #![feature(box_syntax)]
+#![allow(non_fmt_panic)]
 
 fn main() {
     panic!(box 413 as Box<dyn std::any::Any + Send>);
diff --git a/src/test/ui/panics/while-panic.rs b/src/test/ui/panics/while-panic.rs
index 857f65a2252..3c6ee8fa315 100644
--- a/src/test/ui/panics/while-panic.rs
+++ b/src/test/ui/panics/while-panic.rs
@@ -5,7 +5,7 @@
 // ignore-emscripten no processes
 
 fn main() {
-    panic!({
+    panic!("{}", {
         while true {
             panic!("giraffe")
         }