From f19d68f370f594d070f4b1c3d58903e20f5056fd Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 13 Nov 2025 08:51:31 +0100 Subject: [PATCH 1/6] poll_fns test has been fixed in Miri --- tokio/tests/io_async_fd.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tokio/tests/io_async_fd.rs b/tokio/tests/io_async_fd.rs index 51ea79d5155..c9a7302d3fc 100644 --- a/tokio/tests/io_async_fd.rs +++ b/tokio/tests/io_async_fd.rs @@ -479,8 +479,6 @@ async fn multiple_waiters() { } #[tokio::test] -// Block on https://github.com/rust-lang/miri/issues/4374 -#[cfg_attr(miri, ignore)] async fn poll_fns() { let (a, b) = socketpair(); let afd_a = Arc::new(AsyncFd::new(a).unwrap()); From d333f1ab29c7589e8c1e0666552b13c245f5d92e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 13 Nov 2025 09:02:51 +0100 Subject: [PATCH 2/6] Mirigives subthreads a chance to join --- tokio/src/runtime/runtime.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tokio/src/runtime/runtime.rs b/tokio/src/runtime/runtime.rs index 609b27831e8..af1711fad38 100644 --- a/tokio/src/runtime/runtime.rs +++ b/tokio/src/runtime/runtime.rs @@ -431,7 +431,6 @@ impl Runtime { /// use std::time::Duration; /// /// fn main() { - /// # if cfg!(miri) { return } // Miri reports error when main thread terminated without waiting all remaining threads. /// let runtime = Runtime::new().unwrap(); /// /// runtime.block_on(async move { From 702871861c1df77ac86279cec17c9a2e3f888a8b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 13 Nov 2025 09:14:31 +0100 Subject: [PATCH 3/6] update/extend some comments explaining why tests do not run in Miri --- tokio/src/io/stdio_common.rs | 4 ++-- tokio/src/loom/std/mod.rs | 1 + tokio/src/process/unix/orphan.rs | 2 +- tokio/src/runtime/tests/mod.rs | 2 +- tokio/tests/process_change_of_runtime.rs | 2 +- tokio/tests/process_kill_after_wait.rs | 2 +- tokio/tests/process_smoke.rs | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tokio/src/io/stdio_common.rs b/tokio/src/io/stdio_common.rs index 4adbfe23606..a709bef31c4 100644 --- a/tokio/src/io/stdio_common.rs +++ b/tokio/src/io/stdio_common.rs @@ -177,7 +177,7 @@ mod tests { } #[test] - #[cfg_attr(miri, ignore)] + #[cfg_attr(miri, ignore)] // takes a really long time with miri fn test_splitter() { let data = str::repeat("█", DEFAULT_MAX_BUF_SIZE); let mut wr = super::SplitByUtf8BoundaryIfWindows::new(TextMockWriter); @@ -191,7 +191,7 @@ mod tests { } #[test] - #[cfg_attr(miri, ignore)] + #[cfg_attr(miri, ignore)] // takes a really long time with miri fn test_pseudo_text() { // In this test we write a piece of binary data, whose beginning is // text though. We then validate that even in this corner case buffer diff --git a/tokio/src/loom/std/mod.rs b/tokio/src/loom/std/mod.rs index d3556c953cd..68e9716161b 100644 --- a/tokio/src/loom/std/mod.rs +++ b/tokio/src/loom/std/mod.rs @@ -51,6 +51,7 @@ pub(crate) mod sync { // internal use. Note however that some are not _currently_ named by // consuming code. + // Not using parking_lot in Miri due to . #[cfg(all(feature = "parking_lot", not(miri)))] #[allow(unused_imports)] pub(crate) use crate::loom::std::parking_lot::{ diff --git a/tokio/src/process/unix/orphan.rs b/tokio/src/process/unix/orphan.rs index a89555f5876..6aa0539fec4 100644 --- a/tokio/src/process/unix/orphan.rs +++ b/tokio/src/process/unix/orphan.rs @@ -292,7 +292,7 @@ pub(crate) mod test { drop(signal_guard); } - #[cfg_attr(miri, ignore)] // Miri does not support epoll. + #[cfg_attr(miri, ignore)] // No `sigaction` on Miri #[test] fn does_not_register_signal_if_queue_empty() { let (io_driver, io_handle) = IoDriver::new(1024).unwrap(); diff --git a/tokio/src/runtime/tests/mod.rs b/tokio/src/runtime/tests/mod.rs index 5471ffc2e6b..b277cfa6550 100644 --- a/tokio/src/runtime/tests/mod.rs +++ b/tokio/src/runtime/tests/mod.rs @@ -77,7 +77,7 @@ cfg_not_loom! { mod inject; mod queue; - #[cfg(not(miri))] + #[cfg(not(miri))] // takes a really long time with miri mod task_combinations; #[cfg(miri)] diff --git a/tokio/tests/process_change_of_runtime.rs b/tokio/tests/process_change_of_runtime.rs index 968463fdd8b..e1de0bc2188 100644 --- a/tokio/tests/process_change_of_runtime.rs +++ b/tokio/tests/process_change_of_runtime.rs @@ -3,7 +3,7 @@ // This tests test the behavior of `process::Command::spawn` when it is used // outside runtime, and when `process::Child::wait ` is used in a different // runtime from which `process::Command::spawn` is used. -#![cfg(all(unix, not(target_os = "freebsd"), not(miri)))] +#![cfg(all(unix, not(target_os = "freebsd"), not(miri)))] // Miri cannot run system commands use std::process::Stdio; use tokio::{process::Command, runtime::Runtime}; diff --git a/tokio/tests/process_kill_after_wait.rs b/tokio/tests/process_kill_after_wait.rs index 7e1e9fc61f0..639b104fd2c 100644 --- a/tokio/tests/process_kill_after_wait.rs +++ b/tokio/tests/process_kill_after_wait.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi/Miri cannot run system commands use tokio::process::Command; diff --git a/tokio/tests/process_smoke.rs b/tokio/tests/process_smoke.rs index e7fec6d61be..e4785e51ac8 100644 --- a/tokio/tests/process_smoke.rs +++ b/tokio/tests/process_smoke.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi/Miri cannot run system commands use tokio::process::Command; use tokio_test::assert_ok; From 988bbaa40def85c8ec9d8cf31fc300755bc4121c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 13 Nov 2025 09:25:18 +0100 Subject: [PATCH 4/6] these tests seem to work fine on Miri now --- tokio/tests/rt_basic.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tokio/tests/rt_basic.rs b/tokio/tests/rt_basic.rs index cedea3811a3..23845bda53d 100644 --- a/tokio/tests/rt_basic.rs +++ b/tokio/tests/rt_basic.rs @@ -1,6 +1,5 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] -#![cfg(not(miri))] // Possible bug on Miri. use tokio::runtime::Runtime; use tokio::sync::oneshot; From 49e8facadb755404e77e58a91aec7b00dd7e8d06 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 13 Nov 2025 09:44:21 +0100 Subject: [PATCH 5/6] -Zmiri-retag-fields is the default now --- .github/workflows/ci.yml | 6 +++--- CONTRIBUTING.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 885b4f212d4..9530e65c9e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -372,7 +372,7 @@ jobs: cargo miri nextest run --features full --lib --no-fail-fast working-directory: tokio env: - MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields + MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance miri-test: name: miri-test @@ -395,7 +395,7 @@ jobs: cargo miri nextest run --features full --test '*' --no-fail-fast working-directory: tokio env: - MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields + MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance miri-doc: name: miri-doc @@ -414,7 +414,7 @@ jobs: cargo miri test --doc --features $TOKIO_STABLE_FEATURES --no-fail-fast working-directory: tokio env: - MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields + MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance asan: name: asan diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c1cbfc6a5a7..0d12b074495 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -200,7 +200,7 @@ run loom tests that test unstable features. You can run miri tests with ``` -MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields" \ +MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-strict-provenance" \ cargo +nightly miri test --features full --lib --tests ``` From 55ff1529c3fb8f686e5c82b36f4525da4817fdcb Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 13 Nov 2025 10:15:09 +0100 Subject: [PATCH 6/6] bump Miri --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9530e65c9e4..aaa1aef7056 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ env: rust_stable: stable rust_nightly: nightly-2025-10-12 # Pin a specific miri version - rust_miri_nightly: nightly-2025-11-09 + rust_miri_nightly: nightly-2025-11-13 rust_clippy: '1.88' # When updating this, also update: # - README.md