diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-02 22:16:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-02 22:16:14 +0100 |
| commit | fbfa0030162e5a7afd8b175c8ed496b66adf2875 (patch) | |
| tree | 2a57096a734f8f835ee58cb640ad691e511409b0 | |
| parent | dbb9e224af79a6c26c7b887662c5d2c21cf51b88 (diff) | |
| parent | b11d88006cb03a8f50aa09d91aa457d6ec0b8cd8 (diff) | |
| download | rust-fbfa0030162e5a7afd8b175c8ed496b66adf2875.tar.gz rust-fbfa0030162e5a7afd8b175c8ed496b66adf2875.zip | |
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.
| -rw-r--r-- | library/core/tests/slice.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs index 7ba01caeefd..281df8a1326 100644 --- a/library/core/tests/slice.rs +++ b/library/core/tests/slice.rs @@ -2330,6 +2330,7 @@ macro_rules! empty_max_mut { }; } +#[cfg(not(miri))] // Comparing usize::MAX many elements takes forever in Miri (and in rustc without optimizations) take_tests! { slice: &[(); usize::MAX], method: take, (take_in_bounds_max_range_to, (..usize::MAX), Some(EMPTY_MAX), &[(); 0]), @@ -2337,6 +2338,7 @@ take_tests! { (take_in_bounds_max_range_from, (usize::MAX..), Some(&[] as _), EMPTY_MAX), } +#[cfg(not(miri))] // Comparing usize::MAX many elements takes forever in Miri (and in rustc without optimizations) take_tests! { slice: &mut [(); usize::MAX], method: take_mut, (take_mut_in_bounds_max_range_to, (..usize::MAX), Some(empty_max_mut!()), &mut [(); 0]), |
