Skip to content

Commit 8af2f22

Browse files
committed
enable panic-catching tests in Miri
1 parent 3277209 commit 8af2f22

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/liballoc/tests/slice.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,6 @@ fn test_box_slice_clone() {
14051405
#[test]
14061406
#[allow(unused_must_use)] // here, we care about the side effects of `.clone()`
14071407
#[cfg_attr(target_os = "emscripten", ignore)]
1408-
#[cfg(not(miri))] // Miri does not support catching panics
14091408
fn test_box_slice_clone_panics() {
14101409
use std::sync::Arc;
14111410
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -1595,7 +1594,6 @@ thread_local!(static SILENCE_PANIC: Cell<bool> = Cell::new(false));
15951594

15961595
#[test]
15971596
#[cfg_attr(target_os = "emscripten", ignore)] // no threads
1598-
#[cfg(not(miri))] // Miri does not support catching panics
15991597
fn panic_safe() {
16001598
let prev = panic::take_hook();
16011599
panic::set_hook(Box::new(move |info| {
@@ -1606,7 +1604,12 @@ fn panic_safe() {
16061604

16071605
let mut rng = thread_rng();
16081606

1609-
for len in (1..20).chain(70..MAX_LEN) {
1607+
#[cfg(not(miri))] // Miri is too slow
1608+
let large_range = 70..MAX_LEN;
1609+
#[cfg(miri)]
1610+
let large_range = 0..0; // empty range
1611+
1612+
for len in (1..20).chain(large_range) {
16101613
for &modulus in &[5, 20, 50] {
16111614
for &has_runs in &[false, true] {
16121615
let mut input = (0..len)

0 commit comments

Comments
 (0)