]> git.lizzy.rs Git - rust.git/commitdiff
Implement Clone trait for mutable unsafe pointers
authorSeo Sanghyeon <sanxiyn@gmail.com>
Fri, 25 Oct 2013 09:43:55 +0000 (18:43 +0900)
committerSeo Sanghyeon <sanxiyn@gmail.com>
Fri, 25 Oct 2013 09:43:55 +0000 (18:43 +0900)
src/libstd/ptr.rs

index 8803d39b0c67e3c5e41a468a908711bb2ca610e7..376d178f8f723475213c5ba4ed20d1270dd1afe1 100644 (file)
@@ -47,6 +47,13 @@ fn clone(&self) -> *T {
     }
 }
 
+impl<T> Clone for *mut T {
+    #[inline]
+    fn clone(&self) -> *mut T {
+        *self
+    }
+}
+
 /// Return the first offset `i` such that `f(buf[i]) == true`.
 #[inline]
 pub unsafe fn position<T>(buf: *T, f: &fn(&T) -> bool) -> uint {