-
Notifications
You must be signed in to change notification settings - Fork 60
ManuallyDrop layout guarantees? #302
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
That line, and the fact that its |
Put up a documentation PR. Will wait to move forward with that until the discussion here is resolved. |
rustdoc documents the repr whether or not the library guarantees what its private field contains, which sometimes leads to users assuming too much about the inner private field (e.g. rust-lang/rust#72841 (review)). I agree it would be good to clarify this for ManuallyDrop in the docs (and wonder if any other types in std could benefit from clarification). |
In this case, it's very clear that the inner field is a But either way, I think this has been de-facto guaranteed for a while now. It changing would break a lot of existing code, and seems like it was always the intent, so we should guarantee it. |
This seems right to me as well; |
Is there a path forward to this becoming an official position of the UCG WG? Not sure what the rules of parliamentary procedure are for the WG 😛 |
Nothing anywhere in this repo is official. The intended path is that when something is ready to be official then it should just go though the RFC process. |
We really need some procedure by which to declare a libstd |
Clarify that ManuallyDrop<T> has same layout as T This PR implements the documentation change under discussion in rust-lang/unsafe-code-guidelines#302. It should not be approved or merged until the discussion there is resolved.
Clarify that ManuallyDrop<T> has same layout as T This PR implements the documentation change under discussion in rust-lang/unsafe-code-guidelines#302. It should not be approved or merged until the discussion there is resolved.
I guess this should be closed? rust-lang/rust#88375 is merged by now. |
The docs for
ManuallyDrop
state:This hints, but does not explicitly guarantee, that
ManuallyDrop<T>
has the same layout asT
. Do we want to guarantee that?The text was updated successfully, but these errors were encountered: