Skip to content

Commit

Permalink
stabilize const_result
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 5, 2024
1 parent 5a4ee43 commit a221c6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 9 additions & 4 deletions library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,8 @@ impl<T, E> Result<T, E> {
/// ```
#[inline]
#[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> {
match *self {
Ok(ref mut x) => Ok(x),
Expand Down Expand Up @@ -1536,7 +1537,8 @@ impl<T, E> Result<&T, E> {
/// ```
#[inline]
#[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>
where
T: Copy,
Expand Down Expand Up @@ -1586,7 +1588,9 @@ impl<T, E> Result<&mut T, E> {
/// ```
#[inline]
#[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>
where
T: Copy,
Expand Down Expand Up @@ -1639,7 +1643,8 @@ impl<T, E> Result<Option<T>, E> {
/// ```
#[inline]
#[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>> {
match self {
Ok(Some(x)) => Some(Ok(x)),
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#![feature(const_pin)]
#![feature(const_pointer_is_aligned)]
#![feature(const_ptr_write)]
#![feature(const_result)]
#![feature(const_slice_from_ref)]
#![feature(const_three_way_compare)]
#![feature(const_trait_impl)]
Expand Down

0 comments on commit a221c6e

Please sign in to comment.