From 6649ebc4f32be0bca54fae3b405704163c8960fa Mon Sep 17 00:00:00 2001 From: Tom Kaitchuck Date: Wed, 25 Nov 2020 00:22:29 -0800 Subject: [PATCH 1/2] Switch serde test to fnv to advoid 32bit issues --- Cargo.toml | 2 +- tests/serde.rs | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 21bd5c2ce7..024da844af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-all lazy_static = "1.2" rand = { version = "0.7.3", features = ["small_rng"] } rayon = "1.0" -rustc-hash = "=1.0" +fnv = "1.0.7" serde_test = "1.0" doc-comment = "0.3.1" diff --git a/tests/serde.rs b/tests/serde.rs index 570bf70da9..a642348b3b 100644 --- a/tests/serde.rs +++ b/tests/serde.rs @@ -1,24 +1,24 @@ #![cfg(feature = "serde")] use core::hash::BuildHasherDefault; +use fnv::FnvHasher; use hashbrown::{HashMap, HashSet}; -use rustc_hash::FxHasher; use serde_test::{assert_tokens, Token}; -// We use FxHash for this test because we rely on the ordering -type FxHashMap = HashMap>; -type FxHashSet = HashSet>; +// We use FnvHash for this test because we rely on the ordering +type FnvHashMap = HashMap>; +type FnvHashSet = HashSet>; #[test] fn map_serde_tokens_empty() { - let map = FxHashMap::::default(); + let map = FnvHashMap::::default(); assert_tokens(&map, &[Token::Map { len: Some(0) }, Token::MapEnd]); } #[test] fn map_serde_tokens() { - let mut map = FxHashMap::default(); + let mut map = FnvHashMap::default(); map.insert('b', 20); map.insert('a', 10); map.insert('c', 30); @@ -29,10 +29,10 @@ fn map_serde_tokens() { Token::Map { len: Some(3) }, Token::Char('a'), Token::I32(10), - Token::Char('b'), - Token::I32(20), Token::Char('c'), Token::I32(30), + Token::Char('b'), + Token::I32(20), Token::MapEnd, ], ); @@ -40,14 +40,14 @@ fn map_serde_tokens() { #[test] fn set_serde_tokens_empty() { - let set = FxHashSet::::default(); + let set = FnvHashSet::::default(); assert_tokens(&set, &[Token::Seq { len: Some(0) }, Token::SeqEnd]); } #[test] fn set_serde_tokens() { - let mut set = FxHashSet::default(); + let mut set = FnvHashSet::default(); set.insert(20); set.insert(10); set.insert(30); @@ -56,9 +56,9 @@ fn set_serde_tokens() { &set, &[ Token::Seq { len: Some(3) }, + Token::I32(30), Token::I32(20), Token::I32(10), - Token::I32(30), Token::SeqEnd, ], ); From cb6f8177b9de94ee85bba9c454bbdd39910d8420 Mon Sep 17 00:00:00 2001 From: Tom Kaitchuck Date: Fri, 4 Dec 2020 20:48:07 -0800 Subject: [PATCH 2/2] Suppress spurious clippy error. --- src/raw/sse2.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/raw/sse2.rs b/src/raw/sse2.rs index a27bc0910f..632ddb3e45 100644 --- a/src/raw/sse2.rs +++ b/src/raw/sse2.rs @@ -28,6 +28,7 @@ impl Group { /// value for an empty hash table. /// /// This is guaranteed to be aligned to the group size. + #[allow(clippy::items_after_statements)] pub const fn static_empty() -> &'static [u8; Group::WIDTH] { #[repr(C)] struct AlignedBytes {