Closed
Description
Feature gate: #![feature(ptr_const_cast)]
This is a tracking issue for methods on pointers for casting constness without changing the type
Public API
impl<T: ?Sized> *const T {
pub fn as_mut(self) -> *mut T;
}
impl<T: ?Sized> *mut T {
pub fn as_const(self) -> *const T;
}
Steps / History
- Implementation: Implemented const casts of raw pointers #92657
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
Resolved to use*mut T
also already hasas_mut()
which does something different and has a different signature, adding a mehod of the same name to*const T
could be confusing, so maybe a better name should be used.cast_const
/cast_mut
was suggested.cast_*