From 8c22228fe5b64484d49c303461ca8b272ac9bc19 Mon Sep 17 00:00:00 2001 From: Hugues Morisset Date: Fri, 7 Feb 2025 11:49:46 +0100 Subject: [PATCH] Use u64 instead of usize to hash array length size of usize is platform dependent and hashes to a different value on 32bit vs 64bit platform. https://doc.rust-lang.org/std/primitive.usize.html --- core/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/lib.rs b/core/src/lib.rs index ecfe660..0218c73 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -173,7 +173,7 @@ macro_rules! impl_type_hash_array { impl<$T: $crate::TypeHash> TypeHash for [$T; $n] { fn write_hash(hasher: &mut impl std::hash::Hasher) { hasher.write(b"[;]"); - hasher.write_usize($n); + hasher.write_u64($n); $T::write_hash(hasher); } }