-
Notifications
You must be signed in to change notification settings - Fork 353
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
Set -Zrandomize-layout
?
#2656
Comments
Doing this causes a test failure in liballoc:
|
That is just a type size test to avoid size regressions. Should be fine to disable. In any case I don't think it should be enabled for the standard library as it probably breaks layout assumptions in the standard library. |
The stdlib tests all pass except for that one. So seems fine to enable for the standard library? Might be a good way to discover these layout assumptions, and maybe add |
Just rehashing the usual discussion about this flag here so we're all on the same page.
(this is a crate trying to rely on the layout of In aggregate, I am ambivalent-to-no on this. It's not hard to turn on the flag yourself if you want to, and it finds almost no bugs in its current form. The cost and benefit are both rather small, but I think in its current form the flag is more likely to annoy authors of size assertions (because they tend to be written by people who care) than it is to find accidental layout dependencies (because I have debugged a few of those, and they seem to both be rare and mostly written by people who do not care so much about soundness). |
Based on the above, I have removed the flag from cargo-careful, and it seems like we will not set it in Miri (for now). Thanks for the feedback! |
rustc now has a flag to randomize the layout of
repr(Rust)
types which can help detect code that makes incorrect layout assumptions.@rust-lang/miri Is that something Miri should enable? Sounds like it, doesn't it?
The text was updated successfully, but these errors were encountered: