Skip to content

Commit 270f46a

Browse files
authored
chore: support 128-bit TypeId (#1249)
1 parent 5a15d85 commit 270f46a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/isolate.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,8 @@ impl Hasher for TypeIdHasher {
16861686

16871687
#[inline]
16881688
fn write_u64(&mut self, value: u64) {
1689+
// The internal hash function of TypeId only takes the bottom 64-bits, even on versions
1690+
// of Rust that use a 128-bit TypeId.
16891691
let prev_state = self.state.replace(value);
16901692
debug_assert_eq!(prev_state, None);
16911693
}
@@ -1712,8 +1714,14 @@ impl BuildHasher for BuildTypeIdHasher {
17121714
}
17131715

17141716
const _: () = {
1715-
assert!(size_of::<TypeId>() == size_of::<u64>());
1716-
assert!(align_of::<TypeId>() == align_of::<u64>());
1717+
assert!(
1718+
size_of::<TypeId>() == size_of::<u64>()
1719+
|| size_of::<TypeId>() == size_of::<u128>()
1720+
);
1721+
assert!(
1722+
align_of::<TypeId>() == align_of::<u64>()
1723+
|| align_of::<TypeId>() == align_of::<u128>()
1724+
);
17171725
};
17181726

17191727
pub(crate) struct RawSlot {

0 commit comments

Comments
 (0)