about summary refs log tree commit diff
path: root/src/libstd/clone.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-07 05:16:48 -0700
committerbors <bors@rust-lang.org>2014-05-07 05:16:48 -0700
commitef6daf9935da103f1b915a5c9904794da79b0b60 (patch)
treead9695f06d85962039a8f90ac741726b345096aa /src/libstd/clone.rs
parent4a5d39001b1da84fe4be2996a2c7d894d5c248c6 (diff)
parent090040bf4037a094e50b03d79e4baf5cd89c912b (diff)
downloadrust-ef6daf9935da103f1b915a5c9904794da79b0b60.tar.gz
rust-ef6daf9935da103f1b915a5c9904794da79b0b60.zip
auto merge of #13958 : pcwalton/rust/detilde, r=pcwalton
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.

r? @brson or @alexcrichton or whoever
Diffstat (limited to 'src/libstd/clone.rs')
-rw-r--r--src/libstd/clone.rs10
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);
 }