Skip to content

Commit f2fb00d

Browse files
chore: update hashbrown to 0.15 (bytecodealliance#9974)
* chore: update `hashbrown` to 0.15 * fmt
1 parent de1ad34 commit f2fb00d

File tree

5 files changed

+14
-20
lines changed

5 files changed

+14
-20
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ env_logger = "0.11.5"
320320
log = { version = "0.4.8", default-features = false }
321321
clap = { version = "4.5.17", default-features = false, features = ["std", "derive"] }
322322
clap_complete = "4.4.7"
323-
hashbrown = { version = "0.14", default-features = false }
323+
hashbrown = { version = "0.15", default-features = false }
324324
capstone = "0.12.0"
325325
smallvec = { version = "1.6.1", features = ["union"] }
326326
tracing = "0.1.26"

cranelift/codegen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cranelift-entity = { workspace = true }
2929
cranelift-bforest = { workspace = true }
3030
cranelift-bitset = { workspace = true }
3131
cranelift-control = { workspace = true }
32-
hashbrown = { workspace = true, features = ["raw"] }
32+
hashbrown = { workspace = true }
3333
target-lexicon = { workspace = true }
3434
log = { workspace = true }
3535
serde = { workspace = true, optional = true }

cranelift/codegen/src/ctxhash.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! node-internal data references some other storage (e.g., offsets into
55
//! an array or pool of shared data).
66
7-
use hashbrown::raw::RawTable;
7+
use hashbrown::hash_table::HashTable;
88
use std::hash::{Hash, Hasher};
99

1010
/// Trait that allows for equality comparison given some external
@@ -59,15 +59,15 @@ struct BucketData<K, V> {
5959

6060
/// A HashMap that takes external context for all operations.
6161
pub struct CtxHashMap<K, V> {
62-
raw: RawTable<BucketData<K, V>>,
62+
raw: HashTable<BucketData<K, V>>,
6363
}
6464

6565
impl<K, V> CtxHashMap<K, V> {
6666
/// Create an empty hashmap with pre-allocated space for the given
6767
/// capacity.
6868
pub fn with_capacity(capacity: usize) -> Self {
6969
Self {
70-
raw: RawTable::with_capacity(capacity),
70+
raw: HashTable::with_capacity(capacity),
7171
}
7272
}
7373
}
@@ -89,17 +89,14 @@ impl<K, V> CtxHashMap<K, V> {
8989
Ctx: CtxEq<K, K> + CtxHash<K>,
9090
{
9191
let hash = compute_hash(ctx, &k);
92-
match self.raw.find(hash as u64, |bucket| {
92+
match self.raw.find_mut(hash as u64, |bucket| {
9393
hash == bucket.hash && ctx.ctx_eq(&bucket.k, &k)
9494
}) {
95-
Some(bucket) => {
96-
let data = unsafe { bucket.as_mut() };
97-
Some(std::mem::replace(&mut data.v, v))
98-
}
95+
Some(bucket) => Some(std::mem::replace(&mut bucket.v, v)),
9996
None => {
10097
let data = BucketData { hash, k, v };
10198
self.raw
102-
.insert_entry(hash as u64, data, |bucket| bucket.hash as u64);
99+
.insert_unique(hash as u64, data, |bucket| bucket.hash as u64);
103100
None
104101
}
105102
}
@@ -115,10 +112,7 @@ impl<K, V> CtxHashMap<K, V> {
115112
.find(hash as u64, |bucket| {
116113
hash == bucket.hash && ctx.ctx_eq(&bucket.k, k)
117114
})
118-
.map(|bucket| {
119-
let data = unsafe { bucket.as_ref() };
120-
&data.v
121-
})
115+
.map(|bucket| &bucket.v)
122116
}
123117
}
124118

crates/wasmtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ gimli = { workspace = true, optional = true }
6060
addr2line = { workspace = true, optional = true }
6161
semver = { workspace = true, optional = true }
6262
smallvec = { workspace = true, optional = true }
63-
hashbrown = { workspace = true, features = ["ahash"] }
63+
hashbrown = { workspace = true, features = ["default-hasher"] }
6464
bitflags = { workspace = true }
6565

6666
[target.'cfg(target_os = "windows")'.dependencies.windows-sys]

0 commit comments

Comments
 (0)