about summary refs log tree commit diff
path: root/src/liballoc/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-12 10:28:08 +0000
committerbors <bors@rust-lang.org>2020-05-12 10:28:08 +0000
commitd903a9def4c29846ec6215ccc7fa76d39428f577 (patch)
treeaa59db539531cfd59fe1af12db6363baaff96632 /src/liballoc/sync
parent09c817eeb29e764cfc12d0a8d94841e3ffe34023 (diff)
parentceeb9bdee6de1883012be5894c360b34b644fa44 (diff)
downloadrust-d903a9def4c29846ec6215ccc7fa76d39428f577.tar.gz
rust-d903a9def4c29846ec6215ccc7fa76d39428f577.zip
Auto merge of #72134 - Dylan-DPC:rollup-h3shfz5, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71737 (Miri: run liballoc tests with threads)
 - #71928 (Add strikethrough support to rustdoc)
 - #72048 (Visit move out of `_0` when visiting `return`)
 - #72096 (Make MIR typeck use `LocalDefId` and fix docs)
 - #72128 (strings do not have to be valid UTF-8 any more)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc/sync')
-rw-r--r--src/liballoc/sync/tests.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/liballoc/sync/tests.rs b/src/liballoc/sync/tests.rs
index edc2820ee22..a2bb651e2b7 100644
--- a/src/liballoc/sync/tests.rs
+++ b/src/liballoc/sync/tests.rs
@@ -32,7 +32,6 @@ impl Drop for Canary {
 
 #[test]
 #[cfg_attr(target_os = "emscripten", ignore)]
-#[cfg_attr(miri, ignore)] // Miri does not support threads
 fn manually_share_arc() {
     let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
     let arc_v = Arc::new(v);
@@ -337,12 +336,13 @@ fn test_ptr_eq() {
 
 #[test]
 #[cfg_attr(target_os = "emscripten", ignore)]
-#[cfg_attr(miri, ignore)] // Miri does not support threads
 fn test_weak_count_locked() {
     let mut a = Arc::new(atomic::AtomicBool::new(false));
     let a2 = a.clone();
     let t = thread::spawn(move || {
-        for _i in 0..1000000 {
+        // Miri is too slow
+        let count = if cfg!(miri) { 1000 } else { 1000000 };
+        for _i in 0..count {
             Arc::get_mut(&mut a);
         }
         a.store(true, SeqCst);
@@ -351,6 +351,8 @@ fn test_weak_count_locked() {
     while !a2.load(SeqCst) {
         let n = Arc::weak_count(&a2);
         assert!(n < 2, "bad weak count: {}", n);
+        #[cfg(miri)] // Miri's scheduler does not guarantee liveness, and thus needs this hint.
+        atomic::spin_loop_hint();
     }
     t.join().unwrap();
 }