mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
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>]; } ``` |
||
---|---|---|
.. | ||
alloc | ||
backtrace@b02ed04a7e | ||
core | ||
panic_abort | ||
panic_unwind | ||
portable-simd | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@0716b22e90 | ||
test | ||
unwind |