Skip to content

Commit 7acf80d

Browse files
committed
rustup; fix tests for new MIR optimization
1 parent 46a08b7 commit 7acf80d

8 files changed

+15
-117
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d2731d8e9338d8fe844e19d3fbb39617753e65f4
1+
09db05762b283bed62d4f92729cfee4646519833

tests/compile-fail/data_race/dealloc_read_race_stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ignore-windows: Concurrency on Windows is not supported yet.
2-
// compile-flags: -Zmiri-disable-isolation
2+
// compile-flags: -Zmiri-disable-isolation -Zmir-opt-level=0
3+
// With optimizations (in particular #78360), the span becomes much worse, so we disable them.
34

45
use std::thread::{spawn, sleep};
56
use std::ptr::null_mut;
@@ -27,9 +28,6 @@ pub fn main() {
2728
// 3. stack-deallocate
2829
unsafe {
2930
let j1 = spawn(move || {
30-
// Concurrent allocate the memory.
31-
// Uses relaxed semantics to not generate
32-
// a release sequence.
3331
let pointer = &*ptr.0;
3432
{
3533
let mut stack_var = 0usize;
@@ -38,6 +36,8 @@ pub fn main() {
3836

3937
sleep(Duration::from_millis(200));
4038

39+
// Now `stack_var` gets deallocated.
40+
4141
} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2)
4242
});
4343

tests/compile-fail/data_race/dealloc_read_race_stack_drop.rs

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/compile-fail/data_race/dealloc_write_race_stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ignore-windows: Concurrency on Windows is not supported yet.
2-
// compile-flags: -Zmiri-disable-isolation
2+
// compile-flags: -Zmiri-disable-isolation -Zmir-opt-level=0
3+
// With optimizations (in particular #78360), the span becomes much worse, so we disable them.
34

45
use std::thread::{spawn, sleep};
56
use std::ptr::null_mut;
@@ -27,9 +28,6 @@ pub fn main() {
2728
// 3. stack-deallocate
2829
unsafe {
2930
let j1 = spawn(move || {
30-
// Concurrent allocate the memory.
31-
// Uses relaxed semantics to not generate
32-
// a release sequence.
3331
let pointer = &*ptr.0;
3432
{
3533
let mut stack_var = 0usize;
@@ -38,6 +36,8 @@ pub fn main() {
3836

3937
sleep(Duration::from_millis(200));
4038

39+
// Now `stack_var` gets deallocated.
40+
4141
} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2)
4242
});
4343

tests/compile-fail/data_race/dealloc_write_race_stack_drop.rs

Lines changed: 0 additions & 53 deletions
This file was deleted.

tests/compile-fail/sync/libc_pthread_rwlock_read_write_deadlock.rs renamed to tests/compile-fail/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// ignore-windows: No libc on Windows
2+
// error-pattern: deadlock
23

34
#![feature(rustc_private)]
45

@@ -8,6 +9,6 @@ fn main() {
89
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
910
unsafe {
1011
assert_eq!(libc::pthread_rwlock_rdlock(rw.get()), 0);
11-
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
12+
libc::pthread_rwlock_wrlock(rw.get());
1213
}
1314
}

tests/compile-fail/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// ignore-windows: No libc on Windows
2+
// error-pattern: deadlock
23

34
#![feature(rustc_private)]
45

@@ -8,6 +9,6 @@ fn main() {
89
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
910
unsafe {
1011
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
11-
libc::pthread_rwlock_rdlock(rw.get()); //~ ERROR: deadlock
12+
libc::pthread_rwlock_rdlock(rw.get());
1213
}
1314
}

tests/compile-fail/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// ignore-windows: No libc on Windows
2+
// error-pattern: deadlock
23

34
#![feature(rustc_private)]
45

@@ -8,6 +9,6 @@ fn main() {
89
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
910
unsafe {
1011
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
11-
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
12+
libc::pthread_rwlock_wrlock(rw.get());
1213
}
1314
}

0 commit comments

Comments
 (0)