-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Update the mockall dev dependency to 0.13.0 #7234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I don't understand the miri error, even though I can reproduce it locally. It shouldn't be possible for Mockall itself to read uninitialized memory, because Mockall doesn't contain any |
|
I mostly understand the problem now. The uninitialized memory is coming from tokio/tokio/src/io/blocking.rs Line 251 in 0ec4d0d
I don't know why Miri cares about a method that never gets called. |
|
Here's a more complete explanation: asomers/mockall#647 |
|
It is true that implementors of I guess in this case, the problem is that the type is not You can add #[cfg(test)]
buf.fill(0);to silence this error. |
This eliminates a duplicate dependency on syn
|
@Darksonn this behavior will be fixed in the next release of Mockall. However, it will require Rust 1.77.0, which is too new for Tokio. So for now I've fixed the Miri failure by zero-initializing the buffer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Regarding the MSRV, we do not require dev-deps to be compatible with our MSRV.
| // 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this workaround is applied only on &MockFile::read() but not on MockFile::read() above (https://github.com/tokio-rs/tokio/pull/7234/files#diff-66254466385396e6861c43b8488cbed96abb2bffae51f0b57dd9cad896c57edfR59) ?
Is it because MockFile::read() is not used in any tests and Miri does not detect the problem ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds right. I'm fine with adding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it would be better to update mockall to a newer version and remove this workaround. If an application test needs to assert the contents of the destination buffer then these (trailing?) 0s may lead to confusion
@asomers Does 0.13.1 fixes the issue with the early capturing of the method parameters ?
I could try myself after work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asomers Does 0.13.1 fixes the issue with the early capturing of the method parameters ?
I could try myself after work!
No it does not. But the next release of Mockall will.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#7596 adds the workaround for MockFile too
tokio-rs#7234 did it only for &MockFile::read(). The same is needed for the owned version of the API.
This eliminates a duplicate dependency on syn
Motivation
Building mockall-0.11 required tokio to build both syn-1 and syn-2
Solution
Update the mockall dev dependency to the latest version.