Skip to content

Commit 5a6df49

Browse files
committed
Stabilize Option::unwrap_none and Option::expect_none
cc #62633 These methods have been on nightly for over a year without any issues.
1 parent fc2daaa commit 5a6df49

File tree

7 files changed

+2
-16
lines changed

7 files changed

+2
-16
lines changed

compiler/rustc_codegen_ssa/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
22
#![feature(bool_to_option)]
3-
#![feature(option_expect_none)]
43
#![feature(box_patterns)]
54
#![feature(try_blocks)]
65
#![feature(in_band_lifetimes)]

compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#![feature(extern_types)]
3838
#![feature(nll)]
3939
#![feature(once_cell)]
40-
#![feature(option_expect_none)]
4140
#![feature(or_patterns)]
4241
#![feature(min_specialization)]
4342
#![feature(trusted_len)]

compiler/rustc_mir/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Rust MIR: a lowered representation of Rust.
2424
#![feature(associated_type_defaults)]
2525
#![feature(stmt_expr_attributes)]
2626
#![feature(trait_alias)]
27-
#![feature(option_expect_none)]
2827
#![feature(or_patterns)]
2928
#![feature(once_cell)]
3029
#![recursion_limit = "256"]

compiler/rustc_span/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![feature(negative_impls)]
1313
#![feature(nll)]
1414
#![feature(min_specialization)]
15-
#![feature(option_expect_none)]
1615

1716
#[macro_use]
1817
extern crate rustc_macros;

library/core/src/option.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,6 @@ impl<T: fmt::Debug> Option<T> {
10381038
/// # Examples
10391039
///
10401040
/// ```
1041-
/// #![feature(option_expect_none)]
1042-
///
10431041
/// use std::collections::HashMap;
10441042
/// let mut squares = HashMap::new();
10451043
/// for i in -10..=10 {
@@ -1049,8 +1047,6 @@ impl<T: fmt::Debug> Option<T> {
10491047
/// ```
10501048
///
10511049
/// ```{.should_panic}
1052-
/// #![feature(option_expect_none)]
1053-
///
10541050
/// use std::collections::HashMap;
10551051
/// let mut sqrts = HashMap::new();
10561052
/// for i in -10..=10 {
@@ -1061,7 +1057,7 @@ impl<T: fmt::Debug> Option<T> {
10611057
/// ```
10621058
#[inline]
10631059
#[track_caller]
1064-
#[unstable(feature = "option_expect_none", reason = "newly added", issue = "62633")]
1060+
#[stable(feature = "option_expect_none", since = "1.49.0")]
10651061
pub fn expect_none(self, msg: &str) {
10661062
if let Some(val) = self {
10671063
expect_none_failed(msg, &val);
@@ -1080,8 +1076,6 @@ impl<T: fmt::Debug> Option<T> {
10801076
/// # Examples
10811077
///
10821078
/// ```
1083-
/// #![feature(option_unwrap_none)]
1084-
///
10851079
/// use std::collections::HashMap;
10861080
/// let mut squares = HashMap::new();
10871081
/// for i in -10..=10 {
@@ -1091,8 +1085,6 @@ impl<T: fmt::Debug> Option<T> {
10911085
/// ```
10921086
///
10931087
/// ```{.should_panic}
1094-
/// #![feature(option_unwrap_none)]
1095-
///
10961088
/// use std::collections::HashMap;
10971089
/// let mut sqrts = HashMap::new();
10981090
/// for i in -10..=10 {
@@ -1103,7 +1095,7 @@ impl<T: fmt::Debug> Option<T> {
11031095
/// ```
11041096
#[inline]
11051097
#[track_caller]
1106-
#[unstable(feature = "option_unwrap_none", reason = "newly added", issue = "62633")]
1098+
#[stable(feature = "option_unwrap_none", since = "1.49.0")]
11071099
pub fn unwrap_none(self) {
11081100
if let Some(val) = self {
11091101
expect_none_failed("called `Option::unwrap_none()` on a `Some` value", &val);

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#![feature(const_raw_ptr_deref)]
5353
#![feature(never_type)]
5454
#![feature(unwrap_infallible)]
55-
#![feature(option_unwrap_none)]
5655
#![feature(peekable_next_if)]
5756
#![feature(partition_point)]
5857
#![feature(once_cell)]

src/test/ui/rfc-2091-track-caller/std-panic-locations.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// run-pass
22
// ignore-wasm32-bare compiled with panic=abort by default
33

4-
#![feature(option_expect_none, option_unwrap_none)]
54
#![allow(unconditional_panic)]
65

76
//! Test that panic locations for `#[track_caller]` functions in std have the correct

0 commit comments

Comments
 (0)