mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-18 09:53:26 +00:00
Rollup merge of #131287 - RalfJung:const_result, r=tgross35
stabilize const_result Waiting for FCP to complete in https://github.com/rust-lang/rust/issues/82814 Fixes #82814
This commit is contained in:
commit
622fc5e0f3
@ -734,7 +734,8 @@ impl<T, E> Result<T, E> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_result", issue = "82814")]
|
#[rustc_const_stable(feature = "const_result", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
|
||||||
pub const fn as_mut(&mut self) -> Result<&mut T, &mut E> {
|
pub const fn as_mut(&mut self) -> Result<&mut T, &mut E> {
|
||||||
match *self {
|
match *self {
|
||||||
Ok(ref mut x) => Ok(x),
|
Ok(ref mut x) => Ok(x),
|
||||||
@ -1536,7 +1537,8 @@ impl<T, E> Result<&T, E> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "result_copied", since = "1.59.0")]
|
#[stable(feature = "result_copied", since = "1.59.0")]
|
||||||
#[rustc_const_unstable(feature = "const_result", issue = "82814")]
|
#[rustc_const_stable(feature = "const_result", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
|
||||||
pub const fn copied(self) -> Result<T, E>
|
pub const fn copied(self) -> Result<T, E>
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
@ -1586,7 +1588,9 @@ impl<T, E> Result<&mut T, E> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "result_copied", since = "1.59.0")]
|
#[stable(feature = "result_copied", since = "1.59.0")]
|
||||||
#[rustc_const_unstable(feature = "const_result", issue = "82814")]
|
#[rustc_const_stable(feature = "const_result", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
|
||||||
|
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
|
||||||
pub const fn copied(self) -> Result<T, E>
|
pub const fn copied(self) -> Result<T, E>
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
@ -1639,7 +1643,8 @@ impl<T, E> Result<Option<T>, E> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "transpose_result", since = "1.33.0")]
|
#[stable(feature = "transpose_result", since = "1.33.0")]
|
||||||
#[rustc_const_unstable(feature = "const_result", issue = "82814")]
|
#[rustc_const_stable(feature = "const_result", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
|
||||||
pub const fn transpose(self) -> Option<Result<T, E>> {
|
pub const fn transpose(self) -> Option<Result<T, E>> {
|
||||||
match self {
|
match self {
|
||||||
Ok(Some(x)) => Some(Ok(x)),
|
Ok(Some(x)) => Some(Ok(x)),
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#![feature(const_pin)]
|
#![feature(const_pin)]
|
||||||
#![feature(const_pointer_is_aligned)]
|
#![feature(const_pointer_is_aligned)]
|
||||||
#![feature(const_ptr_write)]
|
#![feature(const_ptr_write)]
|
||||||
#![feature(const_result)]
|
|
||||||
#![feature(const_three_way_compare)]
|
#![feature(const_three_way_compare)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
Loading…
Reference in New Issue
Block a user