Closed
Conversation
Member
|
I am not convinced we should do this. For now the MIRI checks only the core part of the library, which IMO is sufficient. We can isolate single threaded tests and run those under MIRI. The tests that run use the threadpool we can ignore under MIRI just like we did already. |
Author
|
Is there a trick to have a test that is checked by |
|
cfg flags |
Member
|
Jeap.. #[test]
#[cfg_attr(miri, ignore)]
fn test_foo() {
let foo = std::str::from_utf8(&[102, 111, 111]).unwrap();
assert_eq!("foo", foo);
} |
Author
|
Ok, now I understand why the problem is in fact easy to solve. Thank you for your patience. |
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
As discussed in #1927, Miri considers by default that a global ThreadPool is an error.
Polars ThreadPool
The following simple function gives an error according to Miri:
Rayon ThreadPool
The following simple function gives an error according to Miri:
Solution
Adding
-Zmiri-ignore-leaksto theMIRIFLAGS, as it seems to be the standard solution with Rayon.What we loose
The serious memory leaks in Rust are not impossible but quite rare.
What we gain
- Performance
We can continue to use Rayon as much as possible without being annoyed by Miri. Indeed, many functions can still be improved in speed.
- Robustness
Making tests on functions using Rayon (namely thanks to our
POOLThreadPool) is possible in order to monitor the bugs.Synthesis
In my opinion, the loss is tiny compared to the improvement on speed and robustness that can be done after this PR.
If we fear for memory leak in some cases, we can still use the default
cargo mirimanually. All the other Miri features are kept.