Skip to content

Commit

Permalink
Rollup merge of #129087 - slanterns:option_get_or_insert_default, r=d…
Browse files Browse the repository at this point in the history
…tolnay

Stabilize `option_get_or_insert_default`

Closes: #82901.

`@rustbot` label: +T-libs-api

r? libs-api
  • Loading branch information
matthiaskrgr authored Sep 27, 2024
2 parents a3f76a2 + aec9116 commit e76eb96
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(map_many_mut)]
#![feature(option_get_or_insert_default)]
#![feature(rustc_attrs)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
Expand Down
4 changes: 1 addition & 3 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1639,8 +1639,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_get_or_insert_default)]
///
/// let mut x = None;
///
/// {
Expand All @@ -1653,7 +1651,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_get_or_insert_default", issue = "82901")]
#[stable(feature = "option_get_or_insert_default", since = "CURRENT_RUSTC_VERSION")]
pub fn get_or_insert_default(&mut self) -> &mut T
where
T: Default,
Expand Down

0 comments on commit e76eb96

Please sign in to comment.