Skip to content

Commit

Permalink
update hashbrown to v0.15.1 (bytecodealliance#1905)
Browse files Browse the repository at this point in the history
Also remove `ahash` and use hashbrown's `default-hasher` crate feature as replacement. This allows to drop yet another `wasmparser` dependency.
  • Loading branch information
Robbepop authored Nov 14, 2024
1 parent aab1ac8 commit a280f52
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ semver = { version = "1.0.0", default-features = false }
smallvec = "1.11.1"
libtest-mimic = "0.7.0"
bitflags = "2.5.0"
hashbrown = { version = "0.14.3", default-features = false, features = ['ahash'] }
hashbrown = { version = "0.15.1", default-features = false, features = ['default-hasher'] }
ahash = { version = "0.8.11", default-features = false }
termcolor = "1.2.0"
indoc = "2.0.5"
Expand Down
4 changes: 1 addition & 3 deletions crates/wasmparser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bitflags = "2.4.1"
indexmap = { workspace = true, optional = true }
semver = { workspace = true, optional = true }
hashbrown = { workspace = true, optional = true }
ahash = { workspace = true, optional = true }
serde = { workspace = true, optional = true }

[dev-dependencies]
Expand Down Expand Up @@ -52,12 +51,11 @@ std = ['indexmap?/std']

# Tells the `wasmparser` crate to provide (and use) hash-based collections internally.
#
# Disabling this crate feature allows to drop `hashbrown`, `indexmap` and `ahash` dependencies
# Disabling this crate feature allows to drop `hashbrown`, `indexmap` dependencies
# entirely, reducing compilation times and shrink binary sizes.
hash-collections = [
'dep:hashbrown',
'dep:indexmap',
'dep:ahash',
]
# Tells the `wasmparser` crate to prefer using its built-in btree-based collections
# even if `hash-collections` is enabled.
Expand Down
8 changes: 4 additions & 4 deletions crates/wasmparser/src/collections/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,24 @@ use std::collections::hash_map::RandomState as RandomStateImpl;
#[derive(Clone, Debug)]
#[cfg(not(feature = "std"))]
struct RandomStateImpl {
state: ahash::RandomState,
state: hashbrown::DefaultHashBuilder,
}

#[cfg(not(feature = "std"))]
impl Default for RandomStateImpl {
fn default() -> RandomStateImpl {
RandomStateImpl {
state: ahash::RandomState::new(),
state: hashbrown::DefaultHashBuilder::default(),
}
}
}

#[cfg(not(feature = "std"))]
impl BuildHasher for RandomStateImpl {
type Hasher = ahash::AHasher;
type Hasher = <hashbrown::DefaultHashBuilder as BuildHasher>::Hasher;

#[inline]
fn build_hasher(&self) -> ahash::AHasher {
fn build_hasher(&self) -> Self::Hasher {
self.state.build_hasher()
}
}

0 comments on commit a280f52

Please sign in to comment.