-
Notifications
You must be signed in to change notification settings - Fork 64
Layout of single-field structs #34
Copy link
Copy link
Closed
Labels
A-layoutTopic: Related to data structure layout (`#[repr]`)Topic: Related to data structure layout (`#[repr]`)C-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-writeup-neededStatus: Ready for a writeup and no one is assignedStatus: Ready for a writeup and no one is assigned
Metadata
Metadata
Assignees
Labels
A-layoutTopic: Related to data structure layout (`#[repr]`)Topic: Related to data structure layout (`#[repr]`)C-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-writeup-neededStatus: Ready for a writeup and no one is assignedStatus: Ready for a writeup and no one is assigned
Type
Fields
Give feedbackNo fields configured for issues without a type.
PR #31 identified this as an area for continued discussion. Specifically, if you have a struct with single field (
struct Foo { x: T }), should we guarantee that the memory layout ofFoois identical to the memory layout ofT(note that ABI details around function calls may still draw a distinction, which is why#[repr(transparent)]is needed). What about zero-sized types likePhantomData?@rkruppe wrote: