about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-19 20:56:51 +0000
committerbors <bors@rust-lang.org>2015-05-19 20:56:51 +0000
commitc322dbbf8a518d00c6db689ca80b0047f2328890 (patch)
treeac2c9c3f341d636046f5f653259ff9a20bbf4938 /src/liballoc
parentf34ff7af7362053e8aee7a35365d6320ed6e88b8 (diff)
parente7e1fd20deb95f74c4a33c76921907e039dff894 (diff)
downloadrust-c322dbbf8a518d00c6db689ca80b0047f2328890.tar.gz
rust-c322dbbf8a518d00c6db689ca80b0047f2328890.zip
Auto merge of #24333 - arielb1:implement-rfc401, r=nrc
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs8
-rw-r--r--src/liballoc/rc.rs4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index ff942444a61..97e85b114b0 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -394,7 +394,9 @@ impl<T: ?Sized> Drop for Arc<T> {
         // it's run more than once)
         let ptr = *self._ptr;
         // if ptr.is_null() { return }
-        if ptr as usize == 0 || ptr as usize == mem::POST_DROP_USIZE { return }
+        if ptr as *mut u8 as usize == 0 || ptr as *mut u8 as usize == mem::POST_DROP_USIZE {
+            return
+        }
 
         // Because `fetch_sub` is already atomic, we do not need to synchronize
         // with other threads unless we are going to delete the object. This
@@ -524,7 +526,9 @@ impl<T: ?Sized> Drop for Weak<T> {
         let ptr = *self._ptr;
 
         // see comments above for why this check is here
-        if ptr as usize == 0 || ptr as usize == mem::POST_DROP_USIZE { return }
+        if ptr as *mut u8 as usize == 0 || ptr as *mut u8 as usize == mem::POST_DROP_USIZE {
+            return
+        }
 
         // If we find out that we were the last weak pointer, then its time to
         // deallocate the data entirely. See the discussion in Arc::drop() about
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 88c5c38172a..b8d8e6ad0a1 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -543,7 +543,7 @@ impl<T: ?Sized> Drop for Rc<T> {
         unsafe {
             let ptr = *self._ptr;
             if !(*(&ptr as *const _ as *const *const ())).is_null() &&
-               ptr as usize != mem::POST_DROP_USIZE {
+               ptr as *const () as usize != mem::POST_DROP_USIZE {
                 self.dec_strong();
                 if self.strong() == 0 {
                     // destroy the contained object
@@ -1051,7 +1051,7 @@ impl<T: ?Sized> Drop for Weak<T> {
         unsafe {
             let ptr = *self._ptr;
             if !(*(&ptr as *const _ as *const *const ())).is_null() &&
-               ptr as usize != mem::POST_DROP_USIZE {
+               ptr as *const () as usize != mem::POST_DROP_USIZE {
                 self.dec_weak();
                 // the weak count starts at 1, and will only go to zero if all
                 // the strong pointers have disappeared.