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) -> usize
core::mem::align_of_val_raw<T: ?Sized>(val: *const T) -> usize
core::alloc::Layout::for_value_raw<T: ?Sized>(t: *const T) -> Layout
These provide raw-pointer variants of the existing mem::size_of_val
, mem::align_of_val
, and Layout::for_value
.
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.
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 calling Layout::for_value_raw
on a pointer that has been drop_in_place
'd, so this likely needs to stay possible._of_val
cannot. Additionally, extern types may want to access the value to determine the size (e.g. a null terminated cstr).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 historystepancheg, dignifiedquire, orzogc and zopsiclevlad20012joseluis
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4