Adapt rustc_data_structures tests to run in strict miri

Some tests took too long and owning_ref is fundamentally flawed,
so don't run these tests or run them with a shorter N. This makes
miri with `-Zmiri-strict-provenance` usable to find UB.
This commit is contained in:
Nilstrieb 2022-06-03 22:01:56 +02:00
parent 44e9516c85
commit fc8b13cb96
3 changed files with 10 additions and 1 deletions

View file

@ -15,7 +15,9 @@ fn test_encode() {
test(u64::MAX as u128, base);
test(u128::MAX, base);
for i in 0..1_000 {
const N: u128 = if cfg!(miri) { 10 } else { 1000 };
for i in 0..N {
test(i * 983, base);
}
}

View file

@ -156,7 +156,10 @@ fn test_deep_linear() {
v
*/
#[cfg(not(miri))]
const NR_NODES: usize = 1 << 14;
#[cfg(miri)]
const NR_NODES: usize = 1 << 3;
let mut nodes = vec![];
for i in 1..NR_NODES {
nodes.push((i - 1, i));

View file

@ -1,3 +1,5 @@
// FIXME: owning_ref is not sound under stacked borrows. Preferably, get rid of it.
#[cfg(not(miri))]
mod owning_ref {
use super::super::OwningRef;
use super::super::{BoxRef, Erased, ErasedBoxRef, RcRef};
@ -361,6 +363,8 @@ mod owning_handle {
}
}
// FIXME: owning_ref is not sound under stacked borrows. Preferably, get rid of it.
#[cfg(not(miri))]
mod owning_ref_mut {
use super::super::BoxRef;
use super::super::{BoxRefMut, Erased, ErasedBoxRefMut, OwningRefMut};