Specifying a set of transmutes from Struct<T> to Struct<U> which are not UB

Ah, sorry. I focused on potential size change. Nevermind then.

That is not in general true, I think. Shared references and mutable references to the same type can have wildly different rules.

For example, &mut T and &mut Cell<T> can be mutually transmuted. The same is not true for &T and &Cell<T>.


Yes. jemalloc and the Windows allocator both provide a much richer interface than the extremely limited malloc/free. malloc/free does not even support asking for a specific alignment for a new allocation.

See this RFC and the resources it references for further information and lots of discussion.


Sounds to me like you want to transmute slices then, not vectors? That's much easier as there is no allocator interaction.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.