Skip to content

Commit

Permalink
Rollup merge of rust-lang#54904 - Kerollmops:stabilize-option-replace…
Browse files Browse the repository at this point in the history
…, r=Centril

Stabilize the `Option::replace` method

This PR stabilize the `Option::replace` method propose in rust-lang#51998.
  • Loading branch information
pietroalbini authored Oct 9, 2018
2 parents e602205 + c232ea1 commit 2f3569b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_replace)]
///
/// let mut x = Some(2);
/// let old = x.replace(5);
/// assert_eq!(x, Some(5));
Expand All @@ -880,7 +878,7 @@ impl<T> Option<T> {
/// assert_eq!(old, None);
/// ```
#[inline]
#[unstable(feature = "option_replace", issue = "51998")]
#[stable(feature = "option_replace", since = "1.31.0")]
pub fn replace(&mut self, value: T) -> Option<T> {
mem::replace(self, Some(value))
}
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#![feature(reverse_bits)]
#![feature(inner_deref)]
#![feature(slice_internals)]
#![feature(option_replace)]
#![feature(slice_partition_dedup)]
#![feature(copy_within)]

Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#![feature(box_syntax)]
#![cfg_attr(unix, feature(libc))]
#![feature(nll)]
#![feature(option_replace)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]
Expand Down

0 comments on commit 2f3569b

Please sign in to comment.