[Feature] AliasableMut/AliasableBox could use #[repr(transparent)]
Opened this issue · 1 comments
talchas commented
If a user wants to pass these directly for use in FFI (not directly the intended use, but plausible and related to some uses), they need to be repr(transparent). Similarly, they could possibly use as_mut_ptr()/into_raw() that do not ever construct a Unique/&mut reference to the target (which would also be a less-pleasant workaround for the first thing).
avitex commented
This is a good idea.
alloc::boxed::Box
doesn't seem to be transparent due to future support around non-zero size handles to allocators, which might be something that might be wanted to be supported here too in the future. As you said, a middle ground providingas_mut_ptr()/into_raw()
could be a good idea.AliasableMut
seems like a good fit for being maderepr(transparent)
however!