-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
No documentation on why packed types + Drop aren't UB #54148
Comments
It doesn't look unaligned https://play.rust-lang.org/?gist=377fe5fbb00ecd7bf72c94a2b2a38fb8&version=stable&mode=debug&edition=2015 |
@sfackler Putting |
Ah, nevermind; apparently, we generate a shim that copies the value before calling drop on it. We should document this. |
cc @arielb1 |
Is it possible to break it if |
@alercah @RalfJung just left a comment about that on the Pin tracking issue. |
@ubsan what would be a good place to document this? Do we have attribute docs so we can put it with repr(packed)?
Might be worth reopening (and renaming) this issue to track that missing doc.
|
The reference seems like the right place for it. |
Or the Rustonomicon? |
I think the long-term vision should be the reference holding normative text, and the 'Nomicon being more of a practical guide. So probably the correct answer is both. |
re-filing against the reference rust-lang/reference#488 if anyone wants to put this in the nomicon, they can, but it's optional, IMHO. |
https://play.rust-lang.org/?gist=73b84464abe00fb3564dbe30f10a4da7&version=stable&mode=debug&edition=2015
<Dropper as Drop>::drop
is passed an unaligned reference toDropper
, which is UB.cc @rust-lang/lang
The text was updated successfully, but these errors were encountered: