about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2014-12-21 21:40:20 -0500
committerLuqman Aden <laden@csclub.uwaterloo.ca>2014-12-28 19:40:48 -0500
commitc15df8e68f62a973b322109101ead205830dc767 (patch)
tree1a7d6edb2b7e97c72e121f7c9b14b7b763d8df48
parentb44d7cb89c57b1fc0495b337dfddbe5cdc2ed6b2 (diff)
downloadrust-c15df8e68f62a973b322109101ead205830dc767.tar.gz
rust-c15df8e68f62a973b322109101ead205830dc767.zip
libcore: Don't impl RawPtr* traits for NonZero.
-rw-r--r--src/libcollections/vec.rs2
-rw-r--r--src/libcore/nonzero.rs63
2 files changed, 2 insertions, 63 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index f65527d3f66..a45e1aa2416 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1120,7 +1120,7 @@ impl<T> Vec<T> {
         }
 
         unsafe {
-            let end = *self.ptr.offset(self.len as int);
+            let end = (*self.ptr).offset(self.len as int);
             ptr::write(&mut *end, value);
             self.len += 1;
         }
diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs
index f976f08bf84..43903871c3f 100644
--- a/src/libcore/nonzero.rs
+++ b/src/libcore/nonzero.rs
@@ -10,18 +10,12 @@
 
 //! Exposes the NonZero lang item which provides optimization hints.
 
-use cmp::Eq;
-use intrinsics;
-use kinds::Copy;
 use ops::Deref;
-use option::Option;
-use option::Option::Some;
-use ptr::{null, null_mut, RawPtr, RawMutPtr};
 
 /// A wrapper type for raw pointers and integers that will never be
 /// NULL or 0 that might allow certain optimizations.
 #[lang="non_zero"]
-#[deriving(Clone, PartialEq, Eq, PartialOrd)]
+#[deriving(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show)]
 #[experimental]
 pub struct NonZero<T>(T);
 
@@ -34,8 +28,6 @@ impl<T> NonZero<T> {
     }
 }
 
-impl<T: Copy> Copy for NonZero<T> {}
-
 impl<T> Deref<T> for NonZero<T> {
     #[inline]
     fn deref<'a>(&'a self) -> &'a T {
@@ -43,56 +35,3 @@ impl<T> Deref<T> for NonZero<T> {
         inner
     }
 }
-
-impl<T> RawPtr<T> for NonZero<*const T> {
-    #[inline]
-    fn null() -> NonZero<*const T> { NonZero(null()) }
-
-    #[inline]
-    fn is_null(&self) -> bool { false }
-
-    #[inline]
-    fn to_uint(&self) -> uint {
-        **self as uint
-    }
-
-    #[inline]
-    unsafe fn offset(self, count: int) -> NonZero<*const T> {
-        NonZero(intrinsics::offset(*self, count))
-    }
-
-    #[inline]
-    unsafe fn as_ref<'a>(&self) -> Option<&'a T> {
-        Some(&***self)
-    }
-}
-
-impl<T> RawPtr<T> for NonZero<*mut T> {
-    #[inline]
-    fn null() -> NonZero<*mut T> { NonZero(null_mut()) }
-
-    #[inline]
-    fn is_null(&self) -> bool { false }
-
-    #[inline]
-    fn to_uint(&self) -> uint {
-        **self as uint
-    }
-
-    #[inline]
-    unsafe fn offset(self, count: int) -> NonZero<*mut T> {
-        NonZero(intrinsics::offset(*self as *const T, count) as *mut T)
-    }
-
-    #[inline]
-    unsafe fn as_ref<'a>(&self) -> Option<&'a T> {
-        Some(&***self)
-    }
-}
-
-impl<T> RawMutPtr<T> for NonZero<*mut T> {
-    #[inline]
-    unsafe fn as_mut<'a>(&self) -> Option<&'a mut T> {
-        Some(&mut ***self)
-    }
-}