Skip to content

Commit ca6d37b

Browse files
authored
Rollup merge of #89951 - ojeda:stable-unwrap_unchecked, r=dtolnay
Stabilize `option_result_unwrap_unchecked` Closes #81383. Stabilization report: #81383 (comment). ``@rustbot`` label +A-option-result +T-libs-api
2 parents 2d8b8f1 + 63d7882 commit ca6d37b

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

library/alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
#![feature(maybe_uninit_slice)]
113113
#![cfg_attr(test, feature(new_uninit))]
114114
#![feature(nonnull_slice_from_raw_parts)]
115-
#![feature(option_result_unwrap_unchecked)]
116115
#![feature(pattern)]
117116
#![feature(ptr_internals)]
118117
#![feature(receiver_trait)]

library/core/src/option.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -800,19 +800,17 @@ impl<T> Option<T> {
800800
/// # Examples
801801
///
802802
/// ```
803-
/// #![feature(option_result_unwrap_unchecked)]
804803
/// let x = Some("air");
805804
/// assert_eq!(unsafe { x.unwrap_unchecked() }, "air");
806805
/// ```
807806
///
808807
/// ```no_run
809-
/// #![feature(option_result_unwrap_unchecked)]
810808
/// let x: Option<&str> = None;
811809
/// assert_eq!(unsafe { x.unwrap_unchecked() }, "air"); // Undefined behavior!
812810
/// ```
813811
#[inline]
814812
#[track_caller]
815-
#[unstable(feature = "option_result_unwrap_unchecked", reason = "newly added", issue = "81383")]
813+
#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
816814
pub unsafe fn unwrap_unchecked(self) -> T {
817815
debug_assert!(self.is_some());
818816
match self {

library/core/src/result.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1096,19 +1096,17 @@ impl<T, E> Result<T, E> {
10961096
/// # Examples
10971097
///
10981098
/// ```
1099-
/// #![feature(option_result_unwrap_unchecked)]
11001099
/// let x: Result<u32, &str> = Ok(2);
11011100
/// assert_eq!(unsafe { x.unwrap_unchecked() }, 2);
11021101
/// ```
11031102
///
11041103
/// ```no_run
1105-
/// #![feature(option_result_unwrap_unchecked)]
11061104
/// let x: Result<u32, &str> = Err("emergency failure");
11071105
/// unsafe { x.unwrap_unchecked(); } // Undefined behavior!
11081106
/// ```
11091107
#[inline]
11101108
#[track_caller]
1111-
#[unstable(feature = "option_result_unwrap_unchecked", reason = "newly added", issue = "81383")]
1109+
#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
11121110
pub unsafe fn unwrap_unchecked(self) -> T {
11131111
debug_assert!(self.is_ok());
11141112
match self {
@@ -1130,19 +1128,17 @@ impl<T, E> Result<T, E> {
11301128
/// # Examples
11311129
///
11321130
/// ```no_run
1133-
/// #![feature(option_result_unwrap_unchecked)]
11341131
/// let x: Result<u32, &str> = Ok(2);
11351132
/// unsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
11361133
/// ```
11371134
///
11381135
/// ```
1139-
/// #![feature(option_result_unwrap_unchecked)]
11401136
/// let x: Result<u32, &str> = Err("emergency failure");
11411137
/// assert_eq!(unsafe { x.unwrap_err_unchecked() }, "emergency failure");
11421138
/// ```
11431139
#[inline]
11441140
#[track_caller]
1145-
#[unstable(feature = "option_result_unwrap_unchecked", reason = "newly added", issue = "81383")]
1141+
#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
11461142
pub unsafe fn unwrap_err_unchecked(self) -> E {
11471143
debug_assert!(self.is_err());
11481144
match self {

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#![feature(const_raw_ptr_deref)]
6060
#![feature(never_type)]
6161
#![feature(unwrap_infallible)]
62-
#![feature(option_result_unwrap_unchecked)]
6362
#![feature(result_into_ok_or_err)]
6463
#![feature(ptr_metadata)]
6564
#![feature(once_cell)]

0 commit comments

Comments
 (0)