commit ac18dfd0c9bcefa67dd552b8598c2e1e49a2eacd
parent 2bf6af9fef2b8b516901b6f6452b68bc5bc9d234
Author: Erich Gubler <erichdongubler@gmail.com>
Date: Fri, 21 Nov 2025 17:46:46 +0000
Bug 2001655 - chore(rust): shim-upgrade `hashlink` 0.10.0 → 0.11.0 r=supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D273589
Diffstat:
14 files changed, 173 insertions(+), 137 deletions(-)
diff --git a/.cargo/config.toml.in b/.cargo/config.toml.in
@@ -30,11 +30,6 @@ git = "https://github.com/beurdouche/nss-gk-api"
rev = "e48a946811ffd64abc78de3ee284957d8d1c0d63"
replace-with = "vendored-sources"
-[source."git+https://github.com/erichdongubler-contrib/hashlink?rev=76dc47a12af5829c1e8bf4834e38b410dec2aeff"]
-git = "https://github.com/erichdongubler-contrib/hashlink"
-rev = "76dc47a12af5829c1e8bf4834e38b410dec2aeff"
-replace-with = "vendored-sources"
-
[source."git+https://github.com/erichdongubler-mozilla/neqo?rev=5bfb65919fb5804ec1dd68cc93e014cb9c830d94"]
git = "https://github.com/erichdongubler-mozilla/neqo"
rev = "5bfb65919fb5804ec1dd68cc93e014cb9c830d94"
diff --git a/Cargo.lock b/Cargo.lock
@@ -2956,8 +2956,16 @@ dependencies = [
[[package]]
name = "hashlink"
-version = "0.10.0"
-source = "git+https://github.com/erichdongubler-contrib/hashlink?rev=76dc47a12af5829c1e8bf4834e38b410dec2aeff#76dc47a12af5829c1e8bf4834e38b410dec2aeff"
+version = "0.10.999"
+dependencies = [
+ "hashlink 0.11.0",
+]
+
+[[package]]
+name = "hashlink"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230"
dependencies = [
"hashbrown 0.16.0",
]
@@ -6103,7 +6111,7 @@ dependencies = [
"bitflags 2.9.0",
"fallible-iterator",
"fallible-streaming-iterator",
- "hashlink",
+ "hashlink 0.10.999",
"libsqlite3-sys",
"serde_json",
"smallvec",
@@ -6475,7 +6483,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
name = "signature_cache"
version = "0.1.0"
dependencies = [
- "hashlink",
+ "hashlink 0.10.999",
]
[[package]]
@@ -8399,7 +8407,7 @@ checksum = "4ce2a4ff45552406d02501cea6c18d8a7e50228e7736a872951fe2fe75c91be7"
dependencies = [
"arraydeque",
"encoding_rs",
- "hashlink",
+ "hashlink 0.10.999",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
@@ -195,6 +195,10 @@ hashbrown_0_14 = { package = "hashbrown", path = "build/rust/hashbrown-0.14" }
# Patch `hashbrown` 0.15.* to depend on 0.16.*
hashbrown_0_15 = { package = "hashbrown", path = "build/rust/hashbrown" }
+# Patch `hashlink` 0.10.* to 0.11.*
+# This technically breaks `hashbrown::DefaultHashBuilder: Copy`, but it's not something we use.
+hashlink = { path = "build/rust/hashlink" }
+
# Patch `thiserror` 1 to 2.
thiserror = { path = "build/rust/thiserror" }
@@ -289,10 +293,6 @@ zip = { path = "third_party/rust/zip" }
# Patch libcrux-traits to avoid unnecessary unused dependencies and conflicts.
libcrux-traits = { path = "build/rust/libcrux-traits" }
-# Patch `hashlink` 0.10.0 to include a `hashbrown` range dependency of 0.15 <= ver <= 0.16: <https://github.com/erichdongubler-contrib/hashlink/pull/6>
-# This technically breaks `hashbrown::DefaultHashBuilder: Copy`, but it's not something we use.
-hashlink = { git = "https://github.com/erichdongubler-contrib/hashlink", rev = "76dc47a12af5829c1e8bf4834e38b410dec2aeff" }
-
[patch."https://github.com/mozilla/neqo"]
neqo-common = { git = "https://github.com/erichdongubler-mozilla/neqo", rev = "5bfb65919fb5804ec1dd68cc93e014cb9c830d94" }
neqo-udp = { git = "https://github.com/erichdongubler-mozilla/neqo", rev = "5bfb65919fb5804ec1dd68cc93e014cb9c830d94" }
diff --git a/build/rust/hashlink/Cargo.toml b/build/rust/hashlink/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "hashlink"
+version = "0.10.999"
+edition = "2021"
+
+[lib]
+path = "lib.rs"
+
+[features]
+
+[dependencies.hashlink]
+version = "0.11.0"
+default-features = false
diff --git a/build/rust/hashlink/lib.rs b/build/rust/hashlink/lib.rs
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+pub use hashlink::*;
diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml
@@ -3067,12 +3067,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "0.10.0 -> 0.11.0"
-[[audits.hashlink]]
-who = "Erich Gubler <erichdongubler@gmail.com>"
-criteria = "safe-to-deploy"
-delta = "0.10.0 -> 0.10.0@git:76dc47a12af5829c1e8bf4834e38b410dec2aeff"
-importable = false
-
[[audits.headers]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-run"
diff --git a/supply-chain/config.toml b/supply-chain/config.toml
@@ -72,10 +72,6 @@ notes = "The dependencies on tokio-reactor and tokio-threadpools are just a hack
criteria = "safe-to-run"
notes = "Used for fuzzing."
-[policy.hashlink]
-audit-as-crates-io = true
-notes = "Only a single change on top of 0.10.0 to allow `hashbrown` 0.16 as a dependency."
-
[policy.http3server]
criteria = "safe-to-run"
notes = "Used for testing."
diff --git a/third_party/rust/hashlink/.cargo-checksum.json b/third_party/rust/hashlink/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{".circleci/config.yml":"255266992e3186622875445cb1906c24f049206cd48ada6ec5987f450bcd54b1","CHANGELOG.md":"a3b85f4904f679858753e00bb5bdd7604bfe7aff22dd06608026dd02502bd11d","Cargo.toml":"83d92a2c28cf88750e6bb1b3c5bdcba6bab40c55c3180c0f4c1586ebbea89c3d","LICENSE-APACHE":"c144680885b29e4719e2a51f0aab5439a1e02d980692b5aaf086cae12727f28b","LICENSE-MIT":"e915669a595b11a200873df8286561881b0e04932f6412a585db6297ba0bc97c","README.md":"f2b040b9aa899d3bd9fbb6c2391054980b00e7f475b6066071c17dd59d614d1c","src/lib.rs":"a4a18633d598bd1940a868b2d93b57bedec6ffdeee3275264e69ec134789bdb9","src/linked_hash_map.rs":"74f08146f554f24c1f70305422ce91d49a2be109aa016c92428933ab40cd2aea","src/linked_hash_set.rs":"5a39efbc0cd4d5be4a743fe71d2b2593892fcab3c12e3b2dba61b831f3a92eba","src/lru_cache.rs":"a0d92f10f903580c546e25aeb1000cf33d7d242070dd52f83165b75dd25efdd0","src/serde.rs":"5b216ccd4b21f3093bb4baf18b9f3943f9ae6f49d2faad2c3b566e8a0cb99851","tests/linked_hash_map.rs":"ee226081892c3149a232ac5ac1ed2bd8f18610470686f9583fd26d6d4dd7accc","tests/linked_hash_set.rs":"35631856063dc0129f8aad241631843b39794a4c1e22d51bd4caba4208512646","tests/lru_cache.rs":"24587003f610932f669f29839503b7ffff82186a5f5d7cff1043b8fe945c2e52","tests/serde.rs":"4e0b1c19c3c542f0b9adac72f6ff32907da6bb58b4f1810dcdf9cd4e2eef34b1"},"package":null}
-\ No newline at end of file
+{"files":{"CHANGELOG.md":"a3b85f4904f679858753e00bb5bdd7604bfe7aff22dd06608026dd02502bd11d","Cargo.lock":"3ccfa6184c92981b8edd52a1a8c3bf2440ad4f7eec6fbead31c1def7fe1cbfcf","Cargo.toml":"c03abc346f4aa30b3e3d6e8056bab92db8812ef268a2768c6dd08d4300ec5a0a","LICENSE-APACHE":"c144680885b29e4719e2a51f0aab5439a1e02d980692b5aaf086cae12727f28b","LICENSE-MIT":"e915669a595b11a200873df8286561881b0e04932f6412a585db6297ba0bc97c","README.md":"f2b040b9aa899d3bd9fbb6c2391054980b00e7f475b6066071c17dd59d614d1c","src/lib.rs":"a4a18633d598bd1940a868b2d93b57bedec6ffdeee3275264e69ec134789bdb9","src/linked_hash_map.rs":"de8959d688371752831563f0886cebe33ce7c52ee477db52b1457e90bda9a65f","src/linked_hash_set.rs":"42cb9c01d80744c04144b5acef50353d915c01d7e1fc669ef1258e39c6df5e87","src/lru_cache.rs":"cd96fa056d49b9285aa43b3e15a1281d558dac1d8e74d5b6bfb2d6e0e711a672","src/serde.rs":"5b216ccd4b21f3093bb4baf18b9f3943f9ae6f49d2faad2c3b566e8a0cb99851","tests/linked_hash_map.rs":"ee226081892c3149a232ac5ac1ed2bd8f18610470686f9583fd26d6d4dd7accc","tests/linked_hash_set.rs":"35631856063dc0129f8aad241631843b39794a4c1e22d51bd4caba4208512646","tests/lru_cache.rs":"24587003f610932f669f29839503b7ffff82186a5f5d7cff1043b8fe945c2e52","tests/serde.rs":"4e0b1c19c3c542f0b9adac72f6ff32907da6bb58b4f1810dcdf9cd4e2eef34b1"},"package":"ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230"}
+\ No newline at end of file
diff --git a/third_party/rust/hashlink/.circleci/config.yml b/third_party/rust/hashlink/.circleci/config.yml
@@ -1,55 +0,0 @@
-version: 2
-
-jobs:
- build:
- docker:
- - image: cimg/rust:1.65.0
- steps:
- - checkout
- - run:
- name: Setup Rust
- command: |
- rustup toolchain uninstall nightly
- rustup toolchain install nightly -c miri rust-src rustfmt
- - run:
- name: Version information
- command: |
- rustc --version
- cargo --version
- rustc +nightly --version
- cargo +nightly --version
- rustup --version
- - run:
- name: Calculate dependencies
- command: cargo generate-lockfile
- - restore_cache:
- keys:
- - cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- - run:
- name: Check Formatting
- command: |
- rustfmt --version
- cargo fmt --all -- --check --color=auto
- - run:
- name: Build all targets
- command: cargo build --all --all-targets
- - run:
- name: Run all tests
- command: cargo test --all --all-features
- - run:
- name: Run all tests under miri
- command: |
- cargo +nightly miri test --all-features
- - run:
- name: Run all tests under sanitizers
- command: |
- RUSTFLAGS="-Z sanitizer=address" cargo +nightly -Z build-std test --target x86_64-unknown-linux-gnu --all-features
- RUSTFLAGS="-Z sanitizer=leak" cargo +nightly test -Z build-std --target x86_64-unknown-linux-gnu --all-features
- RUSTFLAGS="-Z sanitizer=memory" cargo +nightly test -Z build-std --target x86_64-unknown-linux-gnu --all-features
- - save_cache:
- paths:
- - /usr/local/cargo/registry
- - target/debug/.fingerprint
- - target/debug/build
- - target/debug/deps
- key: cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
diff --git a/third_party/rust/hashlink/Cargo.lock b/third_party/rust/hashlink/Cargo.lock
@@ -0,0 +1,107 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "foldhash"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
+
+[[package]]
+name = "hashbrown"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+dependencies = [
+ "foldhash",
+]
+
+[[package]]
+name = "hashlink"
+version = "0.11.0"
+dependencies = [
+ "hashbrown",
+ "rustc-hash",
+ "serde",
+ "serde_test",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.103"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.41"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+
+[[package]]
+name = "serde"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_test"
+version = "1.0.177"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f901ee573cab6b3060453d2d5f0bae4e6d628c23c0a962ff9b5f1d7c8d4f1ed"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.108"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06"
diff --git a/third_party/rust/hashlink/Cargo.toml b/third_party/rust/hashlink/Cargo.toml
@@ -13,8 +13,7 @@
edition = "2018"
rust-version = "1.65"
name = "hashlink"
-version = "0.10.0"
-authors = ["kyren <kerriganw@gmail.com>"]
+version = "0.11.0"
build = false
autolib = false
autobins = false
@@ -59,11 +58,8 @@ name = "serde"
path = "tests/serde.rs"
[dependencies.hashbrown]
-version = ">=0.15,<=0.16"
-features = [
- "default-hasher",
- "inline-more",
-]
+version = "0.16"
+features = ["default-hasher"]
default-features = false
[dependencies.serde]
@@ -71,6 +67,8 @@ version = "1.0"
optional = true
default-features = false
-[dev-dependencies]
-rustc-hash = "2"
-serde_test = "1.0"
+[dev-dependencies.rustc-hash]
+version = "2"
+
+[dev-dependencies.serde_test]
+version = "1.0"
diff --git a/third_party/rust/hashlink/src/linked_hash_map.rs b/third_party/rust/hashlink/src/linked_hash_map.rs
@@ -118,7 +118,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
}
#[inline]
- pub fn iter(&self) -> Iter<K, V> {
+ pub fn iter(&self) -> Iter<'_, K, V> {
let (head, tail) = if let Some(values) = self.values {
unsafe {
let ValueLinks { next, prev } = values.as_ref().links.value;
@@ -137,7 +137,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
}
#[inline]
- pub fn iter_mut(&mut self) -> IterMut<K, V> {
+ pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
let (head, tail) = if let Some(values) = self.values {
unsafe {
let ValueLinks { next, prev } = values.as_ref().links.value;
@@ -183,17 +183,17 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
}
#[inline]
- pub fn keys(&self) -> Keys<K, V> {
+ pub fn keys(&self) -> Keys<'_, K, V> {
Keys { inner: self.iter() }
}
#[inline]
- pub fn values(&self) -> Values<K, V> {
+ pub fn values(&self) -> Values<'_, K, V> {
Values { inner: self.iter() }
}
#[inline]
- pub fn values_mut(&mut self) -> ValuesMut<K, V> {
+ pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
ValuesMut {
inner: self.iter_mut(),
}
@@ -506,7 +506,7 @@ where
}
// Returns the `CursorMut` over the _guard_ node.
- fn cursor_mut(&mut self) -> CursorMut<K, V, S> {
+ fn cursor_mut(&mut self) -> CursorMut<'_, K, V, S> {
unsafe { ensure_guard_node(&mut self.values) };
CursorMut {
cur: self.values.as_ptr(),
@@ -522,7 +522,7 @@ where
/// Note: The `CursorMut` is pointing to the _guard_ node in an empty `LinkedHashMap` and
/// will always return `None` as its current element, regardless of any move in any
/// direction.
- pub fn cursor_front_mut(&mut self) -> CursorMut<K, V, S> {
+ pub fn cursor_front_mut(&mut self) -> CursorMut<'_, K, V, S> {
let mut c = self.cursor_mut();
c.move_next();
c
@@ -533,7 +533,7 @@ where
/// Note: The `CursorMut` is pointing to the _guard_ node in an empty `LinkedHashMap` and
/// will always return `None` as its current element, regardless of any move in any
/// direction.
- pub fn cursor_back_mut(&mut self) -> CursorMut<K, V, S> {
+ pub fn cursor_back_mut(&mut self) -> CursorMut<'_, K, V, S> {
let mut c = self.cursor_mut();
c.move_prev();
c
@@ -973,22 +973,6 @@ where
}
}
-unsafe impl<K, V, S> Send for RawEntryBuilder<'_, K, V, S>
-where
- K: Send,
- V: Send,
- S: Send,
-{
-}
-
-unsafe impl<K, V, S> Sync for RawEntryBuilder<'_, K, V, S>
-where
- K: Sync,
- V: Sync,
- S: Sync,
-{
-}
-
pub struct RawEntryBuilderMut<'a, K, V, S> {
map: &'a mut LinkedHashMap<K, V, S>,
}
@@ -1044,22 +1028,6 @@ where
}
}
-unsafe impl<K, V, S> Send for RawEntryBuilderMut<'_, K, V, S>
-where
- K: Send,
- V: Send,
- S: Send,
-{
-}
-
-unsafe impl<K, V, S> Sync for RawEntryBuilderMut<'_, K, V, S>
-where
- K: Sync,
- V: Sync,
- S: Sync,
-{
-}
-
pub enum RawEntryMut<'a, K, V, S> {
Occupied(RawOccupiedEntryMut<'a, K, V, S>),
Vacant(RawVacantEntryMut<'a, K, V, S>),
@@ -1447,8 +1415,8 @@ impl<K, V> Drain<'_, K, V> {
unsafe impl<K, V> Send for Iter<'_, K, V>
where
- K: Send,
- V: Send,
+ K: Sync,
+ V: Sync,
{
}
diff --git a/third_party/rust/hashlink/src/linked_hash_set.rs b/third_party/rust/hashlink/src/linked_hash_set.rs
@@ -53,7 +53,7 @@ impl<T, S> LinkedHashSet<T, S> {
}
#[inline]
- pub fn drain(&mut self) -> Drain<T> {
+ pub fn drain(&mut self) -> Drain<'_, T> {
Drain {
iter: self.map.drain(),
}
diff --git a/third_party/rust/hashlink/src/lru_cache.rs b/third_party/rust/hashlink/src/lru_cache.rs
@@ -65,19 +65,27 @@ impl<K, V, S> LruCache<K, V, S> {
}
#[inline]
- pub fn iter(&self) -> Iter<K, V> {
+ pub fn iter(&self) -> Iter<'_, K, V> {
self.map.iter()
}
#[inline]
- pub fn iter_mut(&mut self) -> IterMut<K, V> {
+ pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
self.map.iter_mut()
}
#[inline]
- pub fn drain(&mut self) -> Drain<K, V> {
+ pub fn drain(&mut self) -> Drain<'_, K, V> {
self.map.drain()
}
+
+ #[inline]
+ pub fn retain<F>(&mut self, f: F)
+ where
+ F: FnMut(&K, &mut V) -> bool,
+ {
+ self.map.retain(f);
+ }
}
impl<K: Eq + Hash, V, S> LruCache<K, V, S>