Skip to content

Commit 0fc9aee

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 + 97e45e0 commit 0fc9aee

9 files changed

+14
-117
lines changed

ci.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ function run_tests {
2424

2525
./miri test --locked
2626
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
27-
# Only for host architecture: tests with MIR optimizations
28-
MIRIFLAGS="-Z mir-opt-level=3" ./miri test --locked
27+
# Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
28+
# optimizations up all the way).
29+
MIRIFLAGS="-O -Zmir-opt-level=3" ./miri test --locked
2930
fi
3031

3132
# On Windows, there is always "python", not "python3" or "python2".

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ pub fn main() {
2727
// 3. stack-deallocate
2828
unsafe {
2929
let j1 = spawn(move || {
30-
// Concurrent allocate the memory.
31-
// Uses relaxed semantics to not generate
32-
// a release sequence.
3330
let pointer = &*ptr.0;
3431
{
3532
let mut stack_var = 0usize;
@@ -38,6 +35,8 @@ pub fn main() {
3835

3936
sleep(Duration::from_millis(200));
4037

38+
// Now `stack_var` gets deallocated.
39+
4140
} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2)
4241
});
4342

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ pub fn main() {
2727
// 3. stack-deallocate
2828
unsafe {
2929
let j1 = spawn(move || {
30-
// Concurrent allocate the memory.
31-
// Uses relaxed semantics to not generate
32-
// a release sequence.
3330
let pointer = &*ptr.0;
3431
{
3532
let mut stack_var = 0usize;
@@ -38,6 +35,8 @@ pub fn main() {
3835

3936
sleep(Duration::from_millis(200));
4037

38+
// Now `stack_var` gets deallocated.
39+
4140
} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2)
4241
});
4342

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

+2-1
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

+2-1
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)