From afc399f1d06eaba77d5ab816086e5d649d7b8380 Mon Sep 17 00:00:00 2001 From: LimpSquid Date: Fri, 15 May 2026 10:15:58 +0200 Subject: [PATCH] Stabilize bool_to_result --- library/core/src/bool.rs | 12 ++---------- library/coretests/tests/lib.rs | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/library/core/src/bool.rs b/library/core/src/bool.rs index 9b9d2f02550b..751b8d0f1b76 100644 --- a/library/core/src/bool.rs +++ b/library/core/src/bool.rs @@ -78,15 +78,11 @@ pub const fn then T + [const] Destruct>(self, f: F) -> /// # Examples /// /// ``` - /// #![feature(bool_to_result)] - /// /// assert_eq!(false.ok_or(0), Err(0)); /// assert_eq!(true.ok_or(0), Ok(())); /// ``` /// /// ``` - /// #![feature(bool_to_result)] - /// /// let mut a = 0; /// let mut function_with_side_effects = || { a += 1; }; /// @@ -97,7 +93,7 @@ pub const fn then T + [const] Destruct>(self, f: F) -> /// // evaluated eagerly. /// assert_eq!(a, 2); /// ``` - #[unstable(feature = "bool_to_result", issue = "142748")] + #[stable(feature = "bool_to_result", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_bool", issue = "151531")] #[inline] pub const fn ok_or(self, err: E) -> Result<(), E> { @@ -110,15 +106,11 @@ pub const fn ok_or(self, err: E) -> Result<(), E> { /// # Examples /// /// ``` - /// #![feature(bool_to_result)] - /// /// assert_eq!(false.ok_or_else(|| 0), Err(0)); /// assert_eq!(true.ok_or_else(|| 0), Ok(())); /// ``` /// /// ``` - /// #![feature(bool_to_result)] - /// /// let mut a = 0; /// /// assert!(true.ok_or_else(|| { a += 1; }).is_ok()); @@ -128,7 +120,7 @@ pub const fn ok_or(self, err: E) -> Result<(), E> { /// // `ok_or_else`. /// assert_eq!(a, 1); /// ``` - #[unstable(feature = "bool_to_result", issue = "142748")] + #[stable(feature = "bool_to_result", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_bool", issue = "151531")] #[inline] pub const fn ok_or_else E + [const] Destruct>( diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index 12b81fea9d27..6fed117521f8 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -8,7 +8,6 @@ #![feature(ascii_char_variants)] #![feature(async_iter_from_iter)] #![feature(async_iterator)] -#![feature(bool_to_result)] #![feature(borrowed_buf_init)] #![feature(bstr)] #![feature(cfg_target_has_reliable_f16_f128)]