-
Notifications
You must be signed in to change notification settings - Fork 360
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
add option to disable "incorrect layout on deallocation" error check #1873
Comments
Maybe it is right now, but there is no guarantee. In addition there is no guarantee that a user of your crate or even a dependency doesn't override the global allocator with one that requires the alignment to match.
I don't think miri has an option for this. |
Miri is just following the official documentation. The rationale is in https://doc.rust-lang.org/std/alloc/trait.Allocator.html#memory-fitting and indeed does not care if a specific allocator supports having a different alignment at allocation vs deallocation. Unless something changes in the official Furthermore, I personally don't think we should add an option to ignore this error, as it explicitly goes against documented behaviour, unlike the other things where we have opt-outs for, which are for things that haven't been decided on yet. |
It is certainly incorrect to ignore this error, unless you explicitly are setting your own allocator that's fine with bad layout information on deallocation (and if you do, the proper way to make this work is #1207). However, we could in theory have a flag that lets you ignore the error anyway. That would basically mean Miri would deliberately ignore some bugs in your program.
No strong opinion here, but note that we do have |
Yes, I know no guarantee. I report bug to maintainer. I don't want to add
Yes. I hope to markup code block as "known bug here" and feedback to maintainer.
off-topic: Can I build MIRI?
|
For building miri yourself, you can follow the contributor docs: https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md |
That sounds like #788. This is non-trivial though since sometimes one wants the |
We've generally more been moving in the direction of having fewer such unsound flags (e.g. disabling the ABI checks is on its way out), so I don't think we'll want a flag that disables this check. |
I testing code with MIRI,
tested code has
incorrect layout on deallocation
error.https://doc.rust-lang.org/std/vec/struct.Vec.html#method.from_raw_parts
If Allocator implementation is safe against for alignment mismatches to alloc-dealloc, I can ignore the "incorrect layout on deallocation" error.
I think default allocator is SAFE , I decide to ignore this.
I try
miri-disable-alignment-check
MIRIFLAGBut reports
incorrect layout on deallocation
again.Can I ignore this error?
The text was updated successfully, but these errors were encountered: