Tracking Issue for #![feature(pointer_try_cast_aligned)]
· Issue #141221 · rust-lang/rust (original) (raw)
Feature gate: #![feature(pointer_try_cast_aligned)]
This is a tracking issue for adding the convenience method try_cast_aligned
to *const T
, *mut T
and NonNull<T>
.
impl<T: ?Sized> *const T { pub fn try_cast_aligned<U: Sized>(self) -> Option<*const U>; }
impl<T: ?Sized> *mut T { pub fn try_cast_aligned<U: Sized>(self) -> Option<*mut U>; }
impl<T: ?Sized> NonNull { pub fn try_cast_aligned<U: Sized>(self) -> Option<NonNull>; }
Steps / History
- API change proposal (ACP): ACP: ptr::is_aligned_for:: libs-team#588
- Implementation: Implement ptr::try_cast_aligned and NonNull::try_cast_aligned. #141222
- Fix doctest: try_cast_aligned: avoid bare int-to-ptr casts #141381
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
None yet.