Skip to content

Commit c9235f3

Browse files
authored
Add PartialEq impls for Index{Map,Set} types (#1571)
Currently required in Wasmtime so add then back in with the trivial implementations.
1 parent f3128ea commit c9235f3

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

crates/wasmparser/src/collections/index_map.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,3 +633,24 @@ where
633633
})
634634
}
635635
}
636+
637+
impl<K, V> PartialEq for IndexMap<K, V>
638+
where
639+
K: PartialEq + Hash + Ord,
640+
V: PartialEq,
641+
{
642+
fn eq(&self, other: &Self) -> bool {
643+
self.inner == other.inner
644+
}
645+
646+
fn ne(&self, other: &Self) -> bool {
647+
self.inner != other.inner
648+
}
649+
}
650+
651+
impl<K, V> Eq for IndexMap<K, V>
652+
where
653+
K: Eq + Hash + Ord,
654+
V: Eq,
655+
{
656+
}

crates/wasmparser/src/collections/index_set.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,18 @@ where
289289
})
290290
}
291291
}
292+
293+
impl<T> PartialEq for IndexSet<T>
294+
where
295+
T: PartialEq + Hash + Ord,
296+
{
297+
fn eq(&self, other: &Self) -> bool {
298+
self.inner == other.inner
299+
}
300+
301+
fn ne(&self, other: &Self) -> bool {
302+
self.inner != other.inner
303+
}
304+
}
305+
306+
impl<T> Eq for IndexSet<T> where T: Eq + Hash + Ord {}

0 commit comments

Comments
 (0)