1 // We want to control preemption here.
2 //@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0
5 use std::thread::{sleep, spawn};
6 use std::time::Duration;
9 struct EvilSend<T>(pub T);
11 unsafe impl<T> Send for EvilSend<T> {}
12 unsafe impl<T> Sync for EvilSend<T> {}
16 let b = &mut a as *mut u32;
25 // Detach the thread and sleep until it terminates
27 sleep(Duration::from_millis(200));
29 // Spawn and immediately join a thread
30 // to execute the join code-path
31 // and ensure that data-race detection
32 // remains enabled nevertheless.
33 spawn(|| ()).join().unwrap();
36 *c.0 = 64; //~ ERROR: Data race detected between Write on thread `main` and Write on thread `<unnamed>`