From d194e9823c2a51008c2e3b1e2f7b5a6fffead0a1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 16 Jun 2022 10:03:41 -0700 Subject: [PATCH] rustup --- rust-version | 2 +- tests/fail/data_race/fence_after_load.rs | 3 ++- tests/fail/erroneous_const.stderr | 4 ++-- tests/pass/concurrency/channels.rs | 15 ++++++++++++--- tests/pass/threadleak_ignored.rs | 3 ++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/rust-version b/rust-version index 3b3645a97be..792ac12b804 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -546c826f0ccaab36e897860205281f490db274e6 +1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966 diff --git a/tests/fail/data_race/fence_after_load.rs b/tests/fail/data_race/fence_after_load.rs index b3817159338..20cc691f88e 100644 --- a/tests/fail/data_race/fence_after_load.rs +++ b/tests/fail/data_race/fence_after_load.rs @@ -1,4 +1,5 @@ -// compile-flags: -Zmiri-disable-isolation +// We want to control preemption here. +// compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0 // ignore-windows: Concurrency on Windows is not supported yet. use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering, fence}; diff --git a/tests/fail/erroneous_const.stderr b/tests/fail/erroneous_const.stderr index e1758ad657d..d4b8f25e038 100644 --- a/tests/fail/erroneous_const.stderr +++ b/tests/fail/erroneous_const.stderr @@ -6,11 +6,11 @@ LL | const VOID: ! = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error: post-monomorphization error: encountered constants with type errors, stopping evaluation +error: post-monomorphization error: referenced constant has errors --> $DIR/erroneous_const.rs:LL:CC | LL | let _ = PrintName::::VOID; - | ^^^^^^^^^^^^^^^^^^^^ encountered constants with type errors, stopping evaluation + | ^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: inside `no_codegen::` at $DIR/erroneous_const.rs:LL:CC note: inside `main` at $DIR/erroneous_const.rs:LL:CC diff --git a/tests/pass/concurrency/channels.rs b/tests/pass/concurrency/channels.rs index b0c095b2d35..0d6c1749eb5 100644 --- a/tests/pass/concurrency/channels.rs +++ b/tests/pass/concurrency/channels.rs @@ -9,20 +9,23 @@ use std::thread; /// The test taken from the Rust documentation. fn simple_send() { let (tx, rx) = channel(); - thread::spawn(move || { + let t = thread::spawn(move || { tx.send(10).unwrap(); }); assert_eq!(rx.recv().unwrap(), 10); + t.join().unwrap(); } /// The test taken from the Rust documentation. fn multiple_send() { let (tx, rx) = channel(); + let mut threads = vec![]; for i in 0..10 { let tx = tx.clone(); - thread::spawn(move || { + let t = thread::spawn(move || { tx.send(i).unwrap(); }); + threads.push(t); } let mut sum = 0; @@ -32,6 +35,10 @@ fn multiple_send() { sum += j; } assert_eq!(sum, 45); + + for t in threads { + t.join().unwrap(); + } } /// The test taken from the Rust documentation. @@ -41,13 +48,15 @@ fn send_on_sync() { // this returns immediately sender.send(1).unwrap(); - thread::spawn(move || { + let t = thread::spawn(move || { // this will block until the previous message has been received sender.send(2).unwrap(); }); assert_eq!(receiver.recv().unwrap(), 1); assert_eq!(receiver.recv().unwrap(), 2); + + t.join().unwrap(); } fn main() { diff --git a/tests/pass/threadleak_ignored.rs b/tests/pass/threadleak_ignored.rs index cbdc7c6e910..36d39a72b79 100644 --- a/tests/pass/threadleak_ignored.rs +++ b/tests/pass/threadleak_ignored.rs @@ -1,5 +1,6 @@ // ignore-windows: Concurrency on Windows is not supported yet. -// compile-flags: -Zmiri-ignore-leaks +// FIXME: disallow preemption to work around https://github.com/rust-lang/rust/issues/55005 +// compile-flags: -Zmiri-ignore-leaks -Zmiri-preemption-rate=0 //! Test that leaking threads works, and that their destructors are not executed.