diff options
Diffstat (limited to 'components/util/lib.rs')
-rw-r--r-- | components/util/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/components/util/lib.rs b/components/util/lib.rs index 58289bfa581..e820c0e2c11 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -32,6 +32,8 @@ extern crate url; #[phase(plugin)] extern crate string_cache_macros; +use std::sync::Arc; + pub mod bloom; pub mod cache; pub mod debug_utils; @@ -55,3 +57,11 @@ pub mod workqueue; pub fn breakpoint() { unsafe { ::std::intrinsics::breakpoint() }; } + +// Workaround for lack of `ptr_eq` on Arcs... +#[inline] +pub fn arc_ptr_eq<T: 'static + Send + Sync>(a: &Arc<T>, b: &Arc<T>) -> bool { + let a: &T = a.deref(); + let b: &T = b.deref(); + (a as *const T) == (b as *const T) +} |