4d840a6e45
Make `PTR::as_ref` and similar methods `const`. Tracking issue: #91822 Feature gate: `#![feature(const_ptr_as_ref)]` ```rust // core::ptr impl<T: ?Sized> *const T { pub const unsafe fn as_ref<'a>(self) -> Option<&'a T>; pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>> where T: Sized; pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]>; } impl<T: ?Sized> *mut T { pub const unsafe fn as_ref<'a>(self) -> Option<&'a T>; pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>> where T: Sized; pub const unsafe fn as_mut<'a>(self) -> Option<&'a mut T>; pub const unsafe fn as_uninit_mut<'a>(self) -> Option<&'a mut MaybeUninit<T>> where T: Sized; pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]>; pub const unsafe fn as_uninit_slice_mut<'a>(self) -> Option<&'a mut [MaybeUninit<T>]>; } impl<T: Sized> NonNull<T> { pub const unsafe fn as_uninit_ref<'a>(&self) -> &'a MaybeUninit<T>; pub const unsafe fn as_uninit_mut<'a>(&mut self) -> &'a mut MaybeUninit<T>; } impl<T: ?Sized> NonNull<T> { pub const unsafe fn as_ref<'a>(&self) -> &'a T; pub const unsafe fn as_mut<'a>(&mut self) -> &'a mut T; pub const unsafe fn as_uninit_slice<'a>(&self) -> &'a [MaybeUninit<T>]; pub const unsafe fn as_uninit_slice_mut<'a>(&self) -> &'a mut [MaybeUninit<T>]; } ``` |
||
---|---|---|
.. | ||
benches | ||
primitive_docs | ||
src | ||
tests | ||
Cargo.toml |