Skip to content

Commit f440288

Browse files
committed
Auto merge of #1729 - RalfJung:rustup, r=RalfJung
rustup; fix tests for new MIR optimization Somehow rust-lang/rust#78360 manages to mask UB. This would make sense if there were loops or things like that, but there are not, so really this is just very confusing...
2 parents 46a08b7 + 2ef3338 commit f440288

8 files changed

+15
-114
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d2731d8e9338d8fe844e19d3fbb39617753e65f4
1+
09db05762b283bed62d4f92729cfee4646519833

tests/compile-fail/data_race/dealloc_read_race_stack.rs

+4-4
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+
// FIXME: Disabling optimizations since somehow #78360 broke this test.
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

-52
This file was deleted.

tests/compile-fail/data_race/dealloc_write_race_stack.rs

+4-4
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+
// FIXME: Disabling optimizations since somehow #78360 broke this test.
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

-53
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

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// ignore-windows: No libc on Windows
2+
// compile-flags: -Zmir-opt-level=0
3+
// FIXME: Disabling optimizations since somehow #78360 broke this test.
24

35
#![feature(rustc_private)]
46

tests/compile-fail/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// ignore-windows: No libc on Windows
2+
// compile-flags: -Zmir-opt-level=0
3+
// FIXME: Disabling optimizations since somehow #78360 broke this test.
24

35
#![feature(rustc_private)]
46

tests/compile-fail/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// ignore-windows: No libc on Windows
2+
// compile-flags: -Zmir-opt-level=0
3+
// FIXME: Disabling optimizations since somehow #78360 broke this test.
24

35
#![feature(rustc_private)]
46

0 commit comments

Comments
 (0)