-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for layout information behind pointers #69835
Copy link
Copy link
Open
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.S-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.S-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
View all comments
The feature gate for the issue is
#![feature(layout_for_ptr)].This tracks three functions:
core::mem::size_of_val_raw<T: ?Sized>(val: *const T) -> usizecore::mem::align_of_val_raw<T: ?Sized>(val: *const T) -> usizecore::alloc::Layout::for_value_raw<T: ?Sized>(t: *const T) -> LayoutThese provide raw-pointer variants of the existing
mem::size_of_val,mem::align_of_val, andLayout::for_value.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Unresolved Questions
ptr::slice_from_raw_parts. Trait vtable pointers are currently required to always be valid, but this is not guaranteed and an open question whether this is required of invalid pointers.A]Rc's current implementation requires callingLayout::for_value_rawon a pointer that has beendrop_in_place'd, so this likely needs to stay possible._of_valcannot. Additionally, extern types may want to access the value to determine the size (e.g. a null terminated cstr).#![feature(layout_for_ptr)]functions sound to call on invalid data pointers? #86602)rust-lang/lang-team#166 is tangentially related, as it serves to document what requirements currently exist on pointee types and getting a known layout from them.
Implementation history