diff options
| author | bors <bors@rust-lang.org> | 2014-06-25 02:02:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-25 02:02:00 +0000 |
| commit | 91be86af0952aebb1f7c1811a6abcccd7bd1c26e (patch) | |
| tree | 45fd08bfce0007e8e32453b94fd3229d1a13fba3 /src/liballoc | |
| parent | 05ca9f747d62c9385cc142daa3c24a32d32a3f16 (diff) | |
| parent | cdccecb24f5c467282b73413494343d3848b4e5a (diff) | |
| download | rust-91be86af0952aebb1f7c1811a6abcccd7bd1c26e.tar.gz rust-91be86af0952aebb1f7c1811a6abcccd7bd1c26e.zip | |
auto merge of #15163 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/owned.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 16 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 94bf3368a0a..6af4083edb2 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -39,7 +39,7 @@ use heap::deallocate; /// let numbers = Vec::from_fn(100, |i| i as f32); /// let shared_numbers = Arc::new(numbers); /// -/// for _ in range(0, 10) { +/// for _ in range(0u, 10) { /// let child_numbers = shared_numbers.clone(); /// /// spawn(proc() { @@ -110,6 +110,7 @@ impl<T: Share + Send> Arc<T> { } } +#[unstable] impl<T: Share + Send> Clone for Arc<T> { /// Duplicate an atomically reference counted wrapper. /// @@ -236,6 +237,7 @@ impl<T: Share + Send> Weak<T> { } } +#[unstable] impl<T: Share + Send> Clone for Weak<T> { #[inline] fn clone(&self) -> Weak<T> { diff --git a/src/liballoc/owned.rs b/src/liballoc/owned.rs index fa7a8df5035..6f5d3293556 100644 --- a/src/liballoc/owned.rs +++ b/src/liballoc/owned.rs @@ -42,6 +42,7 @@ impl<T: Default> Default for Box<T> { fn default() -> Box<T> { box Default::default() } } +#[unstable] impl<T: Clone> Clone for Box<T> { /// Return a copy of the owned box. #[inline] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index db6af30bce7..a3ca72f1547 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -143,6 +143,7 @@ impl<T> Drop for Rc<T> { } } +#[unstable] impl<T> Clone for Rc<T> { #[inline] fn clone(&self) -> Rc<T> { @@ -224,6 +225,7 @@ impl<T> Drop for Weak<T> { } } +#[unstable] impl<T> Clone for Weak<T> { #[inline] fn clone(&self) -> Weak<T> { @@ -276,7 +278,7 @@ mod tests { #[test] fn test_clone() { - let x = Rc::new(RefCell::new(5)); + let x = Rc::new(RefCell::new(5i)); let y = x.clone(); *x.borrow_mut() = 20; assert_eq!(*y.borrow(), 20); @@ -284,13 +286,13 @@ mod tests { #[test] fn test_simple() { - let x = Rc::new(5); + let x = Rc::new(5i); assert_eq!(*x, 5); } #[test] fn test_simple_clone() { - let x = Rc::new(5); + let x = Rc::new(5i); let y = x.clone(); assert_eq!(*x, 5); assert_eq!(*y, 5); @@ -298,20 +300,20 @@ mod tests { #[test] fn test_destructor() { - let x = Rc::new(box 5); + let x = Rc::new(box 5i); assert_eq!(**x, 5); } #[test] fn test_live() { - let x = Rc::new(5); + let x = Rc::new(5i); let y = x.downgrade(); assert!(y.upgrade().is_some()); } #[test] fn test_dead() { - let x = Rc::new(5); + let x = Rc::new(5i); let y = x.downgrade(); drop(x); assert!(y.upgrade().is_none()); @@ -321,7 +323,7 @@ mod tests { fn gc_inside() { // see issue #11532 use std::gc::GC; - let a = Rc::new(RefCell::new(box(GC) 1)); + let a = Rc::new(RefCell::new(box(GC) 1i)); assert!(a.try_borrow_mut().is_some()); } |
