-
Notifications
You must be signed in to change notification settings - Fork 385
Why does Miri not complain? #2982
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
Comments
It doesn't complain because |
Ah, for some reason I thought this was the case. Are there good patterns to use that will increase the likelihood of Miri catching bugs then? Having your unsafe code use a type that contains an allocation seems like a good trick, but maybe there are others? |
I guess just having good code coverage. It's always a good idea to fuzz your code or at least quickcheck/proptest it. You can try using tools like the Kani model checker to find more test cases for you. But when it comes to testing generic unsafe code, right now we don't have good guidelines beyond being your own worst user and thinking about the possible mis-uses that could happen |
Indeed Miri tests for UB, not soundness. We're open to suggestions for how to better document this, but things are working as intended here. Proving soundness is a really hard problem and I am not aware of any tool that can do it -- you need to do manual proofs in RustBelt. Various tools mentioned above can help find more bugs, though. |
Thanks for the suggestions!
Minimal code examples of what Miri is able to catch vs what it isn't would probably be helpful. And maybe a link to how Miri works so you can figure out the full set of things Miri will be able to catch. |
That sounds like way too much for a readme.^^ We can maybe add a sentence or two to the initial paragraphs that introduce Miri. Miri can catch UB. The problem here isn't a lack of documentation of what Miri does / how it works, the problem is missing the distinction between UB and soundness -- which maybe we can preempt with a short note in the readme? That was my hope anyway. Assuming anyone reads the readme. ;) |
clarify that we do not prove soundness Cc #2982
clarify that we do not prove soundness Cc rust-lang/miri#2982
I'm working on a task scheduler (so that involves very gnarly unsafe code) and I was hoping to be able to rely on Miri, but it seems to require drop types to be able to detect nastiness. The code above passed Miri, but will start failing only if you move the Vec into the closure.
The text was updated successfully, but these errors were encountered: