Skip to content

Commit fbfa003

Browse files
authored
Rollup merge of #91444 - RalfJung:miri-tests, r=dtolnay
disable tests in Miri that take too long Comparing slices of length `usize::MAX` diverges in Miri. In fact these tests even diverge in rustc unless `-O` is passed. I tried this code to check that: ```rust #![feature(slice_take)] const EMPTY_MAX: &'static [()] = &[(); usize::MAX]; fn main() { let mut slice: &[_] = &[(); usize::MAX]; println!("1"); assert_eq!(Some(&[] as _), slice.take(usize::MAX..)); println!("2"); let remaining: &[_] = EMPTY_MAX; println!("3"); assert_eq!(remaining, slice); println!("4"); } ``` So, disable these tests in Miri for now.
2 parents dbb9e22 + b11d880 commit fbfa003

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/tests/slice.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2330,13 +2330,15 @@ macro_rules! empty_max_mut {
23302330
};
23312331
}
23322332

2333+
#[cfg(not(miri))] // Comparing usize::MAX many elements takes forever in Miri (and in rustc without optimizations)
23332334
take_tests! {
23342335
slice: &[(); usize::MAX], method: take,
23352336
(take_in_bounds_max_range_to, (..usize::MAX), Some(EMPTY_MAX), &[(); 0]),
23362337
(take_oob_max_range_to_inclusive, (..=usize::MAX), None, EMPTY_MAX),
23372338
(take_in_bounds_max_range_from, (usize::MAX..), Some(&[] as _), EMPTY_MAX),
23382339
}
23392340

2341+
#[cfg(not(miri))] // Comparing usize::MAX many elements takes forever in Miri (and in rustc without optimizations)
23402342
take_tests! {
23412343
slice: &mut [(); usize::MAX], method: take_mut,
23422344
(take_mut_in_bounds_max_range_to, (..usize::MAX), Some(empty_max_mut!()), &mut [(); 0]),

0 commit comments

Comments
 (0)