From 5490267a79a894c22cc014367e0fcd43f4ad2bb6 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 23 Apr 2025 03:13:10 -0600 Subject: [PATCH] fs: update the mockall dev dependency to 0.13.0 (#7234) --- tokio/Cargo.toml | 2 +- tokio/src/fs/mocks.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index a29b00a8d..a2f2ad6cf 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -131,7 +131,7 @@ features = [ tokio-test = { version = "0.4.0", path = "../tokio-test" } tokio-stream = { version = "0.1", path = "../tokio-stream" } futures = { version = "0.3.0", features = ["async-await"] } -mockall = "0.11.1" +mockall = "0.13.0" async-stream = "0.3" futures-concurrency = "7.6.3" diff --git a/tokio/src/fs/mocks.rs b/tokio/src/fs/mocks.rs index 54da6be93..5343fb90b 100644 --- a/tokio/src/fs/mocks.rs +++ b/tokio/src/fs/mocks.rs @@ -62,6 +62,13 @@ impl Read for MockFile { impl Read for &'_ MockFile { fn read(&mut self, dst: &mut [u8]) -> io::Result { + // Placate Miri. Tokio will call this method with an uninitialized + // buffer, which is ok because std::io::Read::read implementations don't usually read + // from their input buffers. But Mockall 0.12-0.13 will try to Debug::fmt the + // buffer, even if there is no failure, triggering an uninitialized data access alert from + // Miri. Initialize the data here just to prevent those Miri alerts. + // This can be removed after upgrading to Mockall 0.14. + dst.fill(0); self.inner_read(dst) } }