about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcore/ptr.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 61990b745ad..c06f3f1d3a4 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -13,9 +13,9 @@ export memcpy;
 export memmove;
 export memset;
 export to_uint;
+export ref_eq;
 export buf_len;
 export position;
-export extensions;
 export ptr;
 
 import libc::{c_void, size_t};
@@ -150,6 +150,12 @@ fn to_uint<T>(thing: &T) -> uint unsafe {
     unsafe::reinterpret_cast(thing)
 }
 
+/// Determine if two borrowed pointers point to the same thing.
+#[inline(always)]
+fn ref_eq<T>(thing: &T, other: &T) -> bool {
+    to_uint(thing) == to_uint(other)
+}
+
 trait ptr {
     pure fn is_null() -> bool;
     pure fn is_not_null() -> bool;
@@ -236,4 +242,4 @@ fn test_is_null() {
    let q = ptr::offset(p, 1u);
    assert !q.is_null();
    assert q.is_not_null();
-}
\ No newline at end of file
+}