Replace Node's broken impl of cmp:Eq with a generic implementation for cow::Handle.

This commit is contained in:
Brian J. Burg 2012-10-12 18:09:28 -07:00
parent af5985b6e2
commit 9c982693e1
2 changed files with 5 additions and 14 deletions

View file

@ -133,6 +133,11 @@ impl<T:Send,A> Handle<T,A> {
}
}
impl <T: Send,A> Handle<T,A> : cmp::Eq {
pure fn eq(other: &Handle<T,A>) -> bool { *self == **other }
pure fn ne(other: &Handle<T,A>) -> bool { *self != **other }
}
// Private methods
impl<T: Copy Send,A> Scope<T,A> {
fn clone(v: *T) -> *T unsafe {

View file

@ -48,20 +48,6 @@ impl Node {
}
}
/* TODO: LayoutData is just a pointer, but we must circumvent the type
system to actually compare the pointers. This should be fixed in
with a generic implementation of cow::Handle */
impl Node : cmp::Eq {
pure fn eq(other : &Node) -> bool unsafe {
let my_data : @LayoutData = @self.aux(|a| copy *a);
let ot_data : @LayoutData = @other.aux(|a| copy *a);
core::box::ptr_eq(my_data, ot_data)
}
pure fn ne(other : &Node) -> bool unsafe {
!self.eq(other)
}
}
impl Node : DebugMethods {
/* Dumps the subtree rooted at this node, for debugging. */
fn dump(&self) {