-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
A-layoutTopic: Related to data structure layout (`#[repr]`)Topic: Related to data structure layout (`#[repr]`)S-not-opsemDespite being in this repo, this is not primarily a T-opsem questionDespite being in this repo, this is not primarily a T-opsem question
Description
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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-layoutTopic: Related to data structure layout (`#[repr]`)Topic: Related to data structure layout (`#[repr]`)S-not-opsemDespite being in this repo, this is not primarily a T-opsem questionDespite being in this repo, this is not primarily a T-opsem question