Closed
Description
Feature gate: #![feature(ptr_from_ref)]
This is a tracking issue for ptr::from_{ref,mut}
: methods to turn references into raw pointers without using as
casts. We have methods to avoid almost all as casts around raw pointer handling, except for the initial cast from reference to raw pointer. These new methods close that gap. They also ensure that the pointee type T
remains the same, without one having to repeat that type for the cast.
Public API
pub fn from_ref<T: ?Sized>(r: &T) -> *const T;
pub fn from_mut<T: ?Sized>(r: &mut T) -> *mut T;
Steps / History
- Implementation: add ptr::from_{ref,mut} #104977
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.