about summary refs log tree commit diff
path: root/src/libcore/managed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/managed.rs')
-rw-r--r--src/libcore/managed.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcore/managed.rs b/src/libcore/managed.rs
index 2bd3959acf4..debca1ead82 100644
--- a/src/libcore/managed.rs
+++ b/src/libcore/managed.rs
@@ -10,7 +10,7 @@
 
 //! Operations on managed box types
 
-use ptr;
+use ptr::to_unsafe_ptr;
 
 #[cfg(notest)] use cmp::{Eq, Ord};
 
@@ -38,13 +38,15 @@ pub mod raw {
 #[inline(always)]
 pub fn ptr_eq<T>(a: @T, b: @T) -> bool {
     //! Determine if two shared boxes point to the same object
-    ptr::addr_of(&(*a)) == ptr::addr_of(&(*b))
+    let a_ptr: *T = to_unsafe_ptr(&*a), b_ptr: *T = to_unsafe_ptr(&*b);
+    a_ptr == b_ptr
 }
 
 #[inline(always)]
 pub fn mut_ptr_eq<T>(a: @mut T, b: @mut T) -> bool {
     //! Determine if two mutable shared boxes point to the same object
-    ptr::addr_of(&(*a)) == ptr::addr_of(&(*b))
+    let a_ptr: *T = to_unsafe_ptr(&*a), b_ptr: *T = to_unsafe_ptr(&*b);
+    a_ptr == b_ptr
 }
 
 #[cfg(notest)]