Skip to content

Commit e9ad5be

Browse files
committed
Allow/fix non_fmt_panic in tests.
1 parent 34d5ac2 commit e9ad5be

File tree

13 files changed

+42
-35
lines changed

13 files changed

+42
-35
lines changed

library/term/src/terminfo/parm/tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ fn test_comparison_ops() {
7777
for &(op, bs) in v.iter() {
7878
let s = format!("%{{1}}%{{2}}%{}%d", op);
7979
let res = expand(s.as_bytes(), &[], &mut Variables::new());
80-
assert!(res.is_ok(), res.unwrap_err());
80+
assert!(res.is_ok(), "{}", res.unwrap_err());
8181
assert_eq!(res.unwrap(), vec![b'0' + bs[0]]);
8282
let s = format!("%{{1}}%{{1}}%{}%d", op);
8383
let res = expand(s.as_bytes(), &[], &mut Variables::new());
84-
assert!(res.is_ok(), res.unwrap_err());
84+
assert!(res.is_ok(), "{}", res.unwrap_err());
8585
assert_eq!(res.unwrap(), vec![b'0' + bs[1]]);
8686
let s = format!("%{{2}}%{{1}}%{}%d", op);
8787
let res = expand(s.as_bytes(), &[], &mut Variables::new());
88-
assert!(res.is_ok(), res.unwrap_err());
88+
assert!(res.is_ok(), "{}", res.unwrap_err());
8989
assert_eq!(res.unwrap(), vec![b'0' + bs[2]]);
9090
}
9191
}
@@ -95,13 +95,13 @@ fn test_conditionals() {
9595
let mut vars = Variables::new();
9696
let s = b"\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m";
9797
let res = expand(s, &[Number(1)], &mut vars);
98-
assert!(res.is_ok(), res.unwrap_err());
98+
assert!(res.is_ok(), "{}", res.unwrap_err());
9999
assert_eq!(res.unwrap(), "\\E[31m".bytes().collect::<Vec<_>>());
100100
let res = expand(s, &[Number(8)], &mut vars);
101-
assert!(res.is_ok(), res.unwrap_err());
101+
assert!(res.is_ok(), "{}", res.unwrap_err());
102102
assert_eq!(res.unwrap(), "\\E[90m".bytes().collect::<Vec<_>>());
103103
let res = expand(s, &[Number(42)], &mut vars);
104-
assert!(res.is_ok(), res.unwrap_err());
104+
assert!(res.is_ok(), "{}", res.unwrap_err());
105105
assert_eq!(res.unwrap(), "\\E[38;5;42m".bytes().collect::<Vec<_>>());
106106
}
107107

library/test/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn test_should_panic_bad_message() {
199199
fn test_should_panic_non_string_message_type() {
200200
use crate::tests::TrFailedMsg;
201201
fn f() {
202-
panic!(1i32);
202+
std::panic::panic_any(1i32);
203203
}
204204
let expected = "foobar";
205205
let failed_msg = format!(

src/test/ui-fulldeps/issue-15149.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn test() {
5050
.output().unwrap();
5151

5252
assert!(child_output.status.success(),
53-
format!("child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
54-
str::from_utf8(&child_output.stdout).unwrap(),
55-
str::from_utf8(&child_output.stderr).unwrap()));
53+
"child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
54+
str::from_utf8(&child_output.stdout).unwrap(),
55+
str::from_utf8(&child_output.stderr).unwrap());
5656
}

src/test/ui/consts/const-eval/const_panic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(const_panic)]
2+
#![allow(non_fmt_panic)]
23
#![crate_type = "lib"]
34

45
const MSG: &str = "hello";

src/test/ui/consts/const-eval/const_panic.stderr

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,119 @@
11
error: any use of this value will cause an error
2-
--> $DIR/const_panic.rs:6:15
2+
--> $DIR/const_panic.rs:7:15
33
|
44
LL | const Z: () = std::panic!("cheese");
55
| --------------^^^^^^^^^^^^^^^^^^^^^-
66
| |
7-
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:6:15
7+
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15
88
|
99
= note: `#[deny(const_err)]` on by default
1010
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1111
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
1212
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1313

1414
error: any use of this value will cause an error
15-
--> $DIR/const_panic.rs:10:16
15+
--> $DIR/const_panic.rs:11:16
1616
|
1717
LL | const Z2: () = std::panic!();
1818
| ---------------^^^^^^^^^^^^^-
1919
| |
20-
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16
20+
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:11:16
2121
|
2222
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2323
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
2424
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2525

2626
error: any use of this value will cause an error
27-
--> $DIR/const_panic.rs:14:15
27+
--> $DIR/const_panic.rs:15:15
2828
|
2929
LL | const Y: () = std::unreachable!();
3030
| --------------^^^^^^^^^^^^^^^^^^^-
3131
| |
32-
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:14:15
32+
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:15:15
3333
|
3434
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3535
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
3636
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3737

3838
error: any use of this value will cause an error
39-
--> $DIR/const_panic.rs:18:15
39+
--> $DIR/const_panic.rs:19:15
4040
|
4141
LL | const X: () = std::unimplemented!();
4242
| --------------^^^^^^^^^^^^^^^^^^^^^-
4343
| |
44-
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:18:15
44+
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:19:15
4545
|
4646
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4747
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
4848
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4949

5050
error: any use of this value will cause an error
51-
--> $DIR/const_panic.rs:22:15
51+
--> $DIR/const_panic.rs:23:15
5252
|
5353
LL | const W: () = std::panic!(MSG);
5454
| --------------^^^^^^^^^^^^^^^^-
5555
| |
56-
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:22:15
56+
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:23:15
5757
|
5858
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5959
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
6060
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
6161

6262
error: any use of this value will cause an error
63-
--> $DIR/const_panic.rs:26:20
63+
--> $DIR/const_panic.rs:27:20
6464
|
6565
LL | const Z_CORE: () = core::panic!("cheese");
6666
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
6767
| |
68-
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:26:20
68+
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:27:20
6969
|
7070
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7171
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
7272
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
7373

7474
error: any use of this value will cause an error
75-
--> $DIR/const_panic.rs:30:21
75+
--> $DIR/const_panic.rs:31:21
7676
|
7777
LL | const Z2_CORE: () = core::panic!();
7878
| --------------------^^^^^^^^^^^^^^-
7979
| |
80-
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:30:21
80+
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:31:21
8181
|
8282
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8383
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
8484
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
8585

8686
error: any use of this value will cause an error
87-
--> $DIR/const_panic.rs:34:20
87+
--> $DIR/const_panic.rs:35:20
8888
|
8989
LL | const Y_CORE: () = core::unreachable!();
9090
| -------------------^^^^^^^^^^^^^^^^^^^^-
9191
| |
92-
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:34:20
92+
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:35:20
9393
|
9494
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9595
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
9696
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
9797

9898
error: any use of this value will cause an error
99-
--> $DIR/const_panic.rs:38:20
99+
--> $DIR/const_panic.rs:39:20
100100
|
101101
LL | const X_CORE: () = core::unimplemented!();
102102
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
103103
| |
104-
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:38:20
104+
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:39:20
105105
|
106106
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
107107
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
108108
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
109109

110110
error: any use of this value will cause an error
111-
--> $DIR/const_panic.rs:42:20
111+
--> $DIR/const_panic.rs:43:20
112112
|
113113
LL | const W_CORE: () = core::panic!(MSG);
114114
| -------------------^^^^^^^^^^^^^^^^^-
115115
| |
116-
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:42:20
116+
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:43:20
117117
|
118118
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
119119
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>

src/test/ui/drop/dynamic-drop-async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl Allocator {
8282
self.cur_ops.set(self.cur_ops.get() + 1);
8383

8484
if self.cur_ops.get() == self.failing_op {
85-
panic!(InjectedFailure);
85+
panic::panic_any(InjectedFailure);
8686
}
8787
}
8888
}

src/test/ui/drop/dynamic-drop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Allocator {
4646
self.cur_ops.set(self.cur_ops.get() + 1);
4747

4848
if self.cur_ops.get() == self.failing_op {
49-
panic!(InjectedFailure);
49+
panic::panic_any(InjectedFailure);
5050
}
5151

5252
let mut data = self.data.borrow_mut();
@@ -67,7 +67,7 @@ impl<'a> Drop for Ptr<'a> {
6767
self.1.cur_ops.set(self.1.cur_ops.get() + 1);
6868

6969
if self.1.cur_ops.get() == self.1.failing_op {
70-
panic!(InjectedFailure);
70+
panic::panic_any(InjectedFailure);
7171
}
7272
}
7373
}

src/test/ui/macros/assert-macro-owned.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// error-pattern:panicked at 'test-assert-owned'
33
// ignore-emscripten no processes
44

5+
#![allow(non_fmt_panic)]
6+
57
fn main() {
68
assert!(false, "test-assert-owned".to_string());
79
}

src/test/ui/mir/mir_drop_order.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main() {
3838
assert_eq!(get(), vec![0, 2, 3, 1]);
3939

4040
let _ = std::panic::catch_unwind(|| {
41-
(d(4), &d(5), d(6), &d(7), panic!(InjectedFailure));
41+
(d(4), &d(5), d(6), &d(7), panic::panic_any(InjectedFailure));
4242
});
4343

4444
// here, the temporaries (5/7) live until the end of the

src/test/ui/panics/explicit-panic-msg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(unused_assignments)]
22
#![allow(unused_variables)]
3+
#![allow(non_fmt_panic)]
34

45
// run-fail
56
// error-pattern:wooooo

src/test/ui/panics/panic-macro-any-wrapped.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// error-pattern:panicked at 'Box<Any>'
33
// ignore-emscripten no processes
44

5+
#![allow(non_fmt_panic)]
6+
57
fn main() {
68
panic!(Box::new(612_i64));
79
}

src/test/ui/panics/panic-macro-any.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ignore-emscripten no processes
44

55
#![feature(box_syntax)]
6+
#![allow(non_fmt_panic)]
67

78
fn main() {
89
panic!(box 413 as Box<dyn std::any::Any + Send>);

src/test/ui/panics/while-panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// ignore-emscripten no processes
66

77
fn main() {
8-
panic!({
8+
panic!("{}", {
99
while true {
1010
panic!("giraffe")
1111
}

0 commit comments

Comments
 (0)