We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 510b9ea commit 94b6df6Copy full SHA for 94b6df6
tokio/src/fs/mocks.rs
@@ -56,6 +56,13 @@ mock! {
56
57
impl Read for MockFile {
58
fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> {
59
+ // Placate Miri. Tokio will call this method with an uninitialized
60
+ // buffer, which is ok because std::io::Read::read implementations don't usually read
61
+ // from their input buffers. But Mockall 0.12-0.13 will try to Debug::fmt the
62
+ // buffer, even if there is no failure, triggering an uninitialized data access alert from
63
+ // Miri. Initialize the data here just to prevent those Miri alerts.
64
+ // This can be removed after upgrading to Mockall 0.14.
65
+ dst.fill(0);
66
self.inner_read(dst)
67
}
68
0 commit comments