mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Rollup merge of #132966 - RalfJung:const_option_ext, r=jhpratt
stabilize const_option_ext Fixes https://github.com/rust-lang/rust/issues/91930 FCP passed in that issue.
This commit is contained in:
commit
ae5c00f053
@ -120,7 +120,6 @@
|
||||
#![feature(const_float_methods)]
|
||||
#![feature(const_heap)]
|
||||
#![feature(const_nonnull_new)]
|
||||
#![feature(const_option_ext)]
|
||||
#![feature(const_pin_2)]
|
||||
#![feature(const_ptr_is_null)]
|
||||
#![feature(const_ptr_sub_ptr)]
|
||||
|
@ -738,7 +738,7 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "pin", since = "1.33.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
|
||||
// FIXME(const-hack): use `map` once that is possible
|
||||
match Pin::get_ref(self).as_ref() {
|
||||
@ -755,7 +755,7 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "pin", since = "1.33.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
|
||||
// SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.
|
||||
// `x` is guaranteed to be pinned because it comes from `self` which is pinned.
|
||||
@ -802,7 +802,7 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "option_as_slice", since = "1.75.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_slice(&self) -> &[T] {
|
||||
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
|
||||
// to the payload, with a length of 1, so this is equivalent to
|
||||
@ -857,7 +857,7 @@ impl<T> Option<T> {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "option_as_slice", since = "1.75.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn as_mut_slice(&mut self) -> &mut [T] {
|
||||
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
|
||||
// to the payload, with a length of 1, so this is equivalent to
|
||||
|
@ -21,7 +21,6 @@
|
||||
#![feature(const_eval_select)]
|
||||
#![feature(const_heap)]
|
||||
#![feature(const_nonnull_new)]
|
||||
#![feature(const_option_ext)]
|
||||
#![feature(const_pin_2)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(core_intrinsics)]
|
||||
|
Loading…
Reference in New Issue
Block a user