Skip to content

Commit

Permalink
Auto merge of #1729 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
bors committed Mar 2, 2021
2 parents 46a08b7 + 97e45e0 commit 0fc9aee
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 117 deletions.
5 changes: 3 additions & 2 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ function run_tests {

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

# On Windows, there is always "python", not "python3" or "python2".
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d2731d8e9338d8fe844e19d3fbb39617753e65f4
09db05762b283bed62d4f92729cfee4646519833
5 changes: 2 additions & 3 deletions tests/compile-fail/data_race/dealloc_read_race_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ pub fn main() {
// 3. stack-deallocate
unsafe {
let j1 = spawn(move || {
// Concurrent allocate the memory.
// Uses relaxed semantics to not generate
// a release sequence.
let pointer = &*ptr.0;
{
let mut stack_var = 0usize;
Expand All @@ -38,6 +35,8 @@ pub fn main() {

sleep(Duration::from_millis(200));

// Now `stack_var` gets deallocated.

} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2)
});

Expand Down
52 changes: 0 additions & 52 deletions tests/compile-fail/data_race/dealloc_read_race_stack_drop.rs

This file was deleted.

5 changes: 2 additions & 3 deletions tests/compile-fail/data_race/dealloc_write_race_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ pub fn main() {
// 3. stack-deallocate
unsafe {
let j1 = spawn(move || {
// Concurrent allocate the memory.
// Uses relaxed semantics to not generate
// a release sequence.
let pointer = &*ptr.0;
{
let mut stack_var = 0usize;
Expand All @@ -38,6 +35,8 @@ pub fn main() {

sleep(Duration::from_millis(200));

// Now `stack_var` gets deallocated.

} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2)
});

Expand Down
53 changes: 0 additions & 53 deletions tests/compile-fail/data_race/dealloc_write_race_stack_drop.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-windows: No libc on Windows
// error-pattern: deadlock

#![feature(rustc_private)]

Expand All @@ -8,6 +9,6 @@ fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_rdlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
libc::pthread_rwlock_wrlock(rw.get());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-windows: No libc on Windows
// error-pattern: deadlock

#![feature(rustc_private)]

Expand All @@ -8,6 +9,6 @@ fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_rdlock(rw.get()); //~ ERROR: deadlock
libc::pthread_rwlock_rdlock(rw.get());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-windows: No libc on Windows
// error-pattern: deadlock

#![feature(rustc_private)]

Expand All @@ -8,6 +9,6 @@ fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
libc::pthread_rwlock_wrlock(rw.get());
}
}

0 comments on commit 0fc9aee

Please sign in to comment.