Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update string-interner and hashbrown dependencies #1305

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions Cargo.lock

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

6 changes: 2 additions & 4 deletions crates/collections/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ categories.workspace = true
exclude.workspace = true

[dependencies]
hashbrown = { version = "0.14", default-features = false, optional = true, features = ["ahash", "inline-more"] }
string-interner = { version = "0.17", default-features = false, optional = true, features = ["inline-more", "backends"] }
ahash = { version = "0.8.11", default-features = false, optional = true }
hashbrown = { version = "0.15.1", default-features = false, optional = true, features = ["default-hasher", "inline-more"] }
string-interner = { version = "0.18", default-features = false, optional = true, features = ["inline-more", "backends"] }

[features]
default = ["std"]
Expand Down Expand Up @@ -46,7 +45,6 @@ std = ["string-interner?/std"]
hash-collections = [
'dep:hashbrown',
'dep:string-interner',
'dep:ahash',
]
prefer-btree-collections = []

Expand Down
10 changes: 5 additions & 5 deletions crates/collections/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,29 @@ impl Hasher for RandomStateHasher {
#[cfg(feature = "std")]
use std::collections::hash_map::RandomState as RandomStateImpl;

// When the `std` feature is NOT active then rely on `ahash::RandomState`
// When the `std` feature is NOT active then rely on `hashbrown`'s `RandomState`
// which relies on ASLR by default for randomness.
#[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() -> Self {
Self {
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()
}
}
Loading