Skip to content

Commit 2613c9a

Browse files
committed
!!internal/typemap: fix Hash assert on windows
1 parent c09543c commit 2613c9a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/internal/typemap.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,23 @@ impl From<TypeId> for TypeMapKey {
408408
}
409409
}
410410

411-
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
411+
#[derive(Debug, Clone, PartialEq, Eq)]
412412
enum TypeKey {
413413
/// A normal [`TypeId`]
414414
Id(TypeId),
415415
/// A value that has already been hashed, externally
416416
ExtHash(u64),
417417
}
418418

419+
impl std::hash::Hash for TypeKey {
420+
fn hash<H: Hasher>(&self, state: &mut H) {
421+
match self {
422+
TypeKey::Id(id) => id.hash(state),
423+
TypeKey::ExtHash(pre) => pre.hash(state),
424+
}
425+
}
426+
}
427+
419428
/// A hasher designed to eke a little more speed out, given
420429
/// `TypeId`’s known characteristics.
421430
///

0 commit comments

Comments
 (0)