Closed RalfJung closed 4 years ago
Build succeeded:
Presumably you need the Drop
impl because the field is not always initialized when the container is dropped -- so even if the UB rules were different and MaybeUninit
was not necessary, that still wouldn't help, it would just be wrong to always drop?
Yeah that is an interesting quirk that I have not seen yet. Might be worth bringing up in the rust-lang/rust repo in case it hasn't already.
Ah, missed those, thanks!
bors r+
And, as you are going to be bugged by a notification anyway, you might want to look at completely unrelated https://github.com/matklad/once_cell/pull/110/commits/d5295146e2fa80f4e7ad455fd97d21e3002ec885 which exposed an interesting API quirk of
MaybeUninit
. If you useMaybeUninit
, you have to write yourDrop
impl, which requires an (unstable)may_dangle
to be dropck transparent. Am I correct that there's no way to simulateManyallyDrop + may_dangle
on stable, other than just usingOption
instead ofMaybeUninit
?