diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2021-11-14 00:36:19 -0500 |
|---|---|---|
| committer | Jacob Pratt <jacob@jhpratt.dev> | 2021-11-28 01:01:47 -0500 |
| commit | ad8e6bf5ccc60c558dc6ccedb548013d82f6aa8d (patch) | |
| tree | 50f44f204d690c8c0f5451458a93cc37fa2debed /library/core/src/mem | |
| parent | 4919988fe1765e51232558647f2260fff3544658 (diff) | |
Stabilize some `MaybeUninit` behavior as const
Diffstat (limited to 'library/core/src/mem')
| -rw-r--r-- | library/core/src/mem/maybe_uninit.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 624e8795502..a6e31452edc 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -528,7 +528,7 @@ impl<T> MaybeUninit<T> { /// (Notice that the rules around references to uninitialized data are not finalized yet, but /// until they are, it is advisable to avoid them.) #[stable(feature = "maybe_uninit", since = "1.36.0")] - #[rustc_const_unstable(feature = "const_maybe_uninit_as_ptr", issue = "75251")] + #[rustc_const_stable(feature = "const_maybe_uninit_as_ptr", since = "1.59.0")] #[inline(always)] pub const fn as_ptr(&self) -> *const T { // `MaybeUninit` and `ManuallyDrop` are both `repr(transparent)` so we can cast the pointer. @@ -567,7 +567,7 @@ impl<T> MaybeUninit<T> { /// (Notice that the rules around references to uninitialized data are not finalized yet, but /// until they are, it is advisable to avoid them.) #[stable(feature = "maybe_uninit", since = "1.36.0")] - #[rustc_const_unstable(feature = "const_maybe_uninit_as_ptr", issue = "75251")] + #[rustc_const_unstable(feature = "const_maybe_uninit_as_mut_ptr", issue = "75251")] #[inline(always)] pub const fn as_mut_ptr(&mut self) -> *mut T { // `MaybeUninit` and `ManuallyDrop` are both `repr(transparent)` so we can cast the pointer. @@ -620,7 +620,7 @@ impl<T> MaybeUninit<T> { /// // `x` had not been initialized yet, so this last line caused undefined behavior. ⚠️ /// ``` #[stable(feature = "maybe_uninit", since = "1.36.0")] - #[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")] + #[rustc_const_stable(feature = "const_maybe_uninit_assume_init", since = "1.59.0")] #[inline(always)] #[rustc_diagnostic_item = "assume_init"] #[track_caller] @@ -788,7 +788,8 @@ impl<T> MaybeUninit<T> { /// } /// ``` #[stable(feature = "maybe_uninit_ref", since = "1.55.0")] - #[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")] + #[rustc_const_stable(feature = "const_maybe_uninit_assume_init", since = "1.59.0")] + #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_raw_ptr_deref))] #[inline(always)] pub const unsafe fn assume_init_ref(&self) -> &T { // SAFETY: the caller must guarantee that `self` is initialized. @@ -968,7 +969,7 @@ impl<T> MaybeUninit<T> { /// /// [`assume_init_ref`]: MaybeUninit::assume_init_ref #[unstable(feature = "maybe_uninit_slice", issue = "63569")] - #[rustc_const_unstable(feature = "const_maybe_uninit_assume_init", issue = "none")] + #[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")] #[inline(always)] pub const unsafe fn slice_assume_init_ref(slice: &[Self]) -> &[T] { // SAFETY: casting slice to a `*const [T]` is safe since the caller guarantees that |
