From 9c04454e7bb4aeb6592bc0164fce182d0a83e754 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 27 Aug 2012 17:33:22 -0700 Subject: [PATCH] libcore: Implement equality for pointers --- src/libcore/ptr.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 5dcd0a527244..0a2ffd1d9045 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -18,6 +18,7 @@ export buf_len; export position; export Ptr; +import cmp::Eq; import libc::{c_void, size_t}; #[nolink] @@ -170,6 +171,11 @@ impl *T: Ptr { pure fn is_not_null() -> bool { is_not_null(self) } } +// Equality for pointers +impl *T : Eq { + pure fn eq(&&other: *T) -> bool { self == other } +} + #[test] fn test() { unsafe {