about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-06-03 22:01:56 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-06-04 17:46:29 +0200
commitfc8b13cb96a5b45bb7028ca0f50d1444f0f95582 (patch)
treea5a0f90a578041dabd1e0dc8ef3e969f366fb10b /compiler/rustc_data_structures/src
parent44e9516c8535c6f41f2d1c444657cd672b4ab81b (diff)
downloadrust-fc8b13cb96a5b45bb7028ca0f50d1444f0f95582.tar.gz
rust-fc8b13cb96a5b45bb7028ca0f50d1444f0f95582.zip
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.
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/base_n/tests.rs4
-rw-r--r--compiler/rustc_data_structures/src/graph/scc/tests.rs3
-rw-r--r--compiler/rustc_data_structures/src/owning_ref/tests.rs4
3 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/base_n/tests.rs b/compiler/rustc_data_structures/src/base_n/tests.rs
index b68ef1eb7f4..2be2f0532c9 100644
--- a/compiler/rustc_data_structures/src/base_n/tests.rs
+++ b/compiler/rustc_data_structures/src/base_n/tests.rs
@@ -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);
         }
     }
diff --git a/compiler/rustc_data_structures/src/graph/scc/tests.rs b/compiler/rustc_data_structures/src/graph/scc/tests.rs
index 364005e67e6..9940fee60d7 100644
--- a/compiler/rustc_data_structures/src/graph/scc/tests.rs
+++ b/compiler/rustc_data_structures/src/graph/scc/tests.rs
@@ -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));
diff --git a/compiler/rustc_data_structures/src/owning_ref/tests.rs b/compiler/rustc_data_structures/src/owning_ref/tests.rs
index 7b8179e90bd..320c03d5139 100644
--- a/compiler/rustc_data_structures/src/owning_ref/tests.rs
+++ b/compiler/rustc_data_structures/src/owning_ref/tests.rs
@@ -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};