Skip to content

Commit cede211

Browse files
committed
Remove bounds on Prehashed impls
1 parent de0fac2 commit cede211

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

macros/src/track.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ fn create(
194194
Ok(quote! {
195195
use super::*;
196196

197+
#[doc(hidden)]
197198
impl ::comemo::Track for #ty {}
199+
200+
#[doc(hidden)]
198201
impl ::comemo::internal::Trackable for #ty {
199202
type Constraint = #constraint;
200203
type Surface = #family;

src/prehashed.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ use siphasher::sip128::{Hasher128, SipHasher};
1212
/// functions. Especially recursive structures like trees benefit from
1313
/// intermediate prehashed nodes.
1414
///
15-
/// # `Hash` and `Eq`
16-
/// When implementing both `Hash` and `Eq`, the following property [must
17-
/// hold][property]:
18-
/// ```text
19-
/// a == b -> hash(a) == hash(b)
20-
/// ```
21-
/// The inverse implication does not follow from this immediately. However,
22-
/// comemo uses high-quality 128 bit hashes in all places. This reduces the
23-
/// risk of a hash collision to an absolute minimum. Therefore, this trait
15+
/// # Equality
16+
/// Because comemo uses high-quality 128 bit hashes in all places, the risk of a
17+
/// hash collision is reduced to an absolute minimum. Therefore, this trait
2418
/// additionally provides `PartialEq` and `Eq` implementations that compare by
2519
/// hash instead of by value.
2620
///
@@ -101,9 +95,9 @@ impl<T: Default + Hash + 'static> Default for Prehashed<T> {
10195
}
10296
}
10397

104-
impl<T: Eq + ?Sized> Eq for Prehashed<T> {}
98+
impl<T: ?Sized> Eq for Prehashed<T> {}
10599

106-
impl<T: PartialEq + ?Sized> PartialEq for Prehashed<T> {
100+
impl<T: ?Sized> PartialEq for Prehashed<T> {
107101
#[inline]
108102
fn eq(&self, other: &Self) -> bool {
109103
self.hash == other.hash

0 commit comments

Comments
 (0)