diff options
| author | Ralf Jung <post@ralfj.de> | 2023-10-10 09:46:10 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-10-10 09:47:16 +0200 |
| commit | d3b761a772d0a7a4ac7fadab7f91f8370eb1fbf2 (patch) | |
| tree | 8735eeac7258f0cb9d349072217d0e1db86b338d | |
| parent | aaba0a5806a963453a712c70d84909010dd2de50 (diff) | |
| download | rust-d3b761a772d0a7a4ac7fadab7f91f8370eb1fbf2.tar.gz rust-d3b761a772d0a7a4ac7fadab7f91f8370eb1fbf2.zip | |
avoid confusing loop in catch_panic test
| -rw-r--r-- | src/tools/miri/tests/pass/panic/catch_panic.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tools/miri/tests/pass/panic/catch_panic.rs b/src/tools/miri/tests/pass/panic/catch_panic.rs index e4a7f8e3481..f5b4eaf685d 100644 --- a/src/tools/miri/tests/pass/panic/catch_panic.rs +++ b/src/tools/miri/tests/pass/panic/catch_panic.rs @@ -5,6 +5,7 @@ use std::cell::Cell; use std::panic::{catch_unwind, AssertUnwindSafe}; +use std::process; thread_local! { static MY_COUNTER: Cell<usize> = Cell::new(0); @@ -62,26 +63,26 @@ fn main() { // Built-in panics; also make sure the message is right. test(Some("index out of bounds: the len is 3 but the index is 4"), |_old_val| { let _val = [0, 1, 2][4]; - loop {} + process::abort() }); test(Some("attempt to divide by zero"), |_old_val| { let _val = 1 / 0; - loop {} + process::abort() }); test(Some("align_offset: align is not a power-of-two"), |_old_val| { let _ = std::ptr::null::<u8>().align_offset(3); - loop {} + process::abort() }); // Assertion and debug assertion test(None, |_old_val| { assert!(false); - loop {} + process::abort() }); test(None, |_old_val| { debug_assert!(false); - loop {} + process::abort() }); eprintln!("Success!"); // Make sure we get this in stderr |
