Manual adjustments

This commit is contained in:
David Tolnay 2022-06-20 02:43:06 -07:00
parent ee132c8d07
commit fed5ea8b10
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,9 @@ pub fn main() {
let b = &mut a as *mut AtomicUsize;
let c = EvilSend(b);
unsafe {
let j1 = spawn(move || *(c.0 as *mut usize));
let j1 = spawn(move || {
let _val = *(c.0 as *mut usize);
});
let j2 = spawn(move || {
//Equivalent to: (&*c.0).store(32, Ordering::SeqCst)

View File

@ -13,7 +13,9 @@ pub fn main() {
let b = &mut a as *mut u32;
let c = EvilSend(b);
unsafe {
let j1 = spawn(move || *c.0);
let j1 = spawn(move || {
let _val = *c.0;
});
let j2 = spawn(move || {
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 2) and Read on Thread(id = 1)