diff options
Diffstat (limited to 'src/libstd/clone.rs')
| -rw-r--r-- | src/libstd/clone.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libstd/clone.rs b/src/libstd/clone.rs index e25f9c5ad4f..36d1cd9ba94 100644 --- a/src/libstd/clone.rs +++ b/src/libstd/clone.rs @@ -21,6 +21,8 @@ the `clone` method. */ +use owned::Box; + /// A common trait for cloning an object. pub trait Clone { /// Returns a copy of the value. The contents of owned pointers @@ -39,14 +41,14 @@ pub trait Clone { } } -impl<T: Clone> Clone for ~T { +impl<T: Clone> Clone for Box<T> { /// Return a copy of the owned box. #[inline] - fn clone(&self) -> ~T { box {(**self).clone()} } + fn clone(&self) -> Box<T> { box {(**self).clone()} } /// Perform copy-assignment from `source` by reusing the existing allocation. #[inline] - fn clone_from(&mut self, source: &~T) { + fn clone_from(&mut self, source: &Box<T>) { (**self).clone_from(&(**source)); } } @@ -127,7 +129,7 @@ extern_fn_clone!(A, B, C, D, E, F, G, H) #[test] fn test_owned_clone() { let a = box 5i; - let b: ~int = a.clone(); + let b: Box<int> = a.clone(); assert_eq!(a, b); } |
