From fd064e041af61b497778583013298e5d828ffff6 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 5 Dec 2017 09:07:12 -0700 Subject: [PATCH 1/3] Stablize RefCell::{replace, swap} RefCell::replace_with is not stablized in this PR, since it wasn't part of the RFC. --- src/libcore/cell.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index d4cd3f6264efc..5da4a5de742ee 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -584,7 +584,6 @@ impl RefCell { /// # Examples /// /// ``` - /// #![feature(refcell_replace_swap)] /// use std::cell::RefCell; /// let cell = RefCell::new(5); /// let old_value = cell.replace(6); @@ -592,7 +591,7 @@ impl RefCell { /// assert_eq!(cell, RefCell::new(6)); /// ``` #[inline] - #[unstable(feature = "refcell_replace_swap", issue="43570")] + #[stable(feature = "refcell_replace_swap", since="1.24.0")] pub fn replace(&self, t: T) -> T { mem::replace(&mut *self.borrow_mut(), t) } @@ -636,7 +635,6 @@ impl RefCell { /// # Examples /// /// ``` - /// #![feature(refcell_replace_swap)] /// use std::cell::RefCell; /// let c = RefCell::new(5); /// let d = RefCell::new(6); @@ -645,7 +643,7 @@ impl RefCell { /// assert_eq!(d, RefCell::new(5)); /// ``` #[inline] - #[unstable(feature = "refcell_replace_swap", issue="43570")] + #[stable(feature = "refcell_replace_swap", since="1.24.0")] pub fn swap(&self, other: &Self) { mem::swap(&mut *self.borrow_mut(), &mut *other.borrow_mut()) } From 28a19bfa7f418d3aa4cbe6da3aba4b3b2fb87a13 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 5 Dec 2017 12:03:57 -0700 Subject: [PATCH 2/3] Move replace_with to its own feature flag I'm not allowed to have the same feature flag associated with multiple stability levels. --- src/libcore/cell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 5da4a5de742ee..dc9f4b88c206b 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -616,7 +616,7 @@ impl RefCell { /// assert_eq!(cell, RefCell::new(6)); /// ``` #[inline] - #[unstable(feature = "refcell_replace_swap", issue="43570")] + #[unstable(feature = "refcell_replace_with", issue="43570")] pub fn replace_with T>(&self, f: F) -> T { let mut_borrow = &mut *self.borrow_mut(); let replacement = f(mut_borrow); From 19775f73a39c73298c3507fe861bec8dae4e4c1f Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 5 Dec 2017 13:15:35 -0700 Subject: [PATCH 3/3] Update cell.rs --- src/libcore/cell.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index dc9f4b88c206b..d2690ff64ac48 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -591,7 +591,7 @@ impl RefCell { /// assert_eq!(cell, RefCell::new(6)); /// ``` #[inline] - #[stable(feature = "refcell_replace_swap", since="1.24.0")] + #[stable(feature = "refcell_replace", since="1.24.0")] pub fn replace(&self, t: T) -> T { mem::replace(&mut *self.borrow_mut(), t) } @@ -616,7 +616,7 @@ impl RefCell { /// assert_eq!(cell, RefCell::new(6)); /// ``` #[inline] - #[unstable(feature = "refcell_replace_with", issue="43570")] + #[unstable(feature = "refcell_replace_swap", issue="43570")] pub fn replace_with T>(&self, f: F) -> T { let mut_borrow = &mut *self.borrow_mut(); let replacement = f(mut_borrow); @@ -643,7 +643,7 @@ impl RefCell { /// assert_eq!(d, RefCell::new(5)); /// ``` #[inline] - #[stable(feature = "refcell_replace_swap", since="1.24.0")] + #[stable(feature = "refcell_swap", since="1.24.0")] pub fn swap(&self, other: &Self) { mem::swap(&mut *self.borrow_mut(), &mut *other.borrow_mut()) }