As I understand it, generally two otherwise identical Rust type definitions (e.g. struct Foo(u8, usize), struct Bar(u8, usize)) do not need to produce transmutable types, trivially shown by using -Zrandomize-layout with identically defined structs with a couple fields.
However, of course (u8, usize) and (u8, usize) can be transmuted, after all, they are the same type. The same goes for Generic<u8> and Generic<u8>.
What if we have #[repr(transparent)] struct Wrap(u8);: Are (Wrap, usize) and (u8, usize) transmutable?
What about Generic<u8> and Generic<Wrap> where Generic is some generic struct?
How far does repr(transparent) stretch in its equivalency when the transparent type is used as a field elsewhere?
As I understand it, generally two otherwise identical Rust type definitions (e.g.
struct Foo(u8, usize),struct Bar(u8, usize)) do not need to produce transmutable types, trivially shown by using-Zrandomize-layoutwith identically defined structs with a couple fields.However, of course
(u8, usize)and(u8, usize)can be transmuted, after all, they are the same type. The same goes forGeneric<u8>andGeneric<u8>.What if we have
#[repr(transparent)] struct Wrap(u8);: Are(Wrap, usize)and(u8, usize)transmutable?What about
Generic<u8>andGeneric<Wrap>whereGenericis some generic struct?How far does
repr(transparent)stretch in its equivalency when the transparent type is used as a field elsewhere?