Skip to content

Commit

Permalink
chore(deps/rand): update to rand v0.9.0 (#3574)
Browse files Browse the repository at this point in the history
supersedes #3569.

this branch updates [`rand`](https://github.com/rust-random/rand) from 0.8.5 to 0.9.0.

- [release notes](https://github.com/rust-random/rand/releases)
- [changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [commits](rust-random/rand@0.8.5...0.9.0)

note the changes to `rand::distr::weighted::Error`'s variants. see
rust-random/rand#1382, and
rust-random/rand#1470. in particular, this change:

https://github.com/rust-random/rand/pull/1382/files#diff-b0eb1b0ef894742b65e07f23af6cbeffae64ec8311adb6ea606603e978023e0cL116-R113

most other changes in this branch relate to the renaming of `thread_rng()` to `rng()`,
and `gen()` to `random()`.

---

* build(deps): bump rand from 0.8.5 to 0.9.0

Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.0.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](rust-random/rand@0.8.5...0.9.0)

---
updated-dependencies:
- dependency-name: rand
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(exp-backoff): address `rand` breaking changes

Signed-off-by: katelyn martin <[email protected]>

* chore(pool/p2c): address `rand` breaking changes

Signed-off-by: katelyn martin <[email protected]>

* chore(distribute): address `rand` breaking changes

see rust-random/rand#1382.

in particular, this part of the change:

https://github.com/rust-random/rand/pull/1382/files#diff-b0eb1b0ef894742b65e07f23af6cbeffae64ec8311adb6ea606603e978023e0cL116-R113

see also rust-random/rand#1470.

Signed-off-by: katelyn martin <[email protected]>

* chore(http/route): address `rand` breaking changes

Signed-off-by: katelyn martin <[email protected]>

* chore(exp-backoff): address `rand` breaking changes

Signed-off-by: katelyn martin <[email protected]>

* chore(deny.toml): skip previous `rand` dependencies

this addresses some ci errors related to duplicate dependencies:

```
error[duplicate]: found 2 duplicate entries for crate 'getrandom'
   ┌─ /github/workspace/Cargo.lock:75:1
   │
75 │ ╭ getrandom 0.2.15 registry+https://github.com/rust-lang/crates.io-index
76 │ │ getrandom 0.3.1 registry+https://github.com/rust-lang/crates.io-index
   │ ╰─────────────────────────────────────────────────────────────────────┘ lock entries
   │
```

Signed-off-by: katelyn martin <[email protected]>

* review(distribute): add `use` statement

Signed-off-by: katelyn martin <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: katelyn martin <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
cratelyn and dependabot[bot] authored Jan 28, 2025
1 parent 2062f0c commit 31d9e8f
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 59 deletions.
137 changes: 109 additions & 28 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"getrandom",
"getrandom 0.2.15",
"once_cell",
"version_check",
"zerocopy",
"zerocopy 0.7.35",
]

[[package]]
Expand Down Expand Up @@ -753,7 +753,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"libc",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
]

[[package]]
name = "getrandom"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
dependencies = [
"cfg-if",
"libc",
"wasi 0.13.3+wasi-0.2.2",
"windows-targets 0.52.0",
]

[[package]]
Expand Down Expand Up @@ -860,7 +872,7 @@ dependencies = [
"idna",
"ipnet",
"once_cell",
"rand",
"rand 0.8.5",
"thiserror 1.0.69",
"tinyvec",
"tokio",
Expand All @@ -881,7 +893,7 @@ dependencies = [
"lru-cache",
"once_cell",
"parking_lot",
"rand",
"rand 0.8.5",
"resolv-conf",
"smallvec",
"thiserror 1.0.69",
Expand Down Expand Up @@ -1261,7 +1273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [
"cfg-if",
"windows-targets 0.48.5",
"windows-targets 0.52.0",
]

[[package]]
Expand Down Expand Up @@ -1584,7 +1596,7 @@ dependencies = [
"ahash",
"linkerd-stack",
"parking_lot",
"rand",
"rand 0.9.0",
"tokio",
"tokio-test",
"tower-test",
Expand Down Expand Up @@ -1653,7 +1665,7 @@ dependencies = [
"futures",
"pin-project",
"quickcheck",
"rand",
"rand 0.9.0",
"thiserror 2.0.11",
"tokio",
]
Expand Down Expand Up @@ -1820,7 +1832,7 @@ dependencies = [
"http",
"linkerd2-proxy-api",
"maplit",
"rand",
"rand 0.9.0",
"regex",
"thiserror 2.0.11",
"tracing",
Expand Down Expand Up @@ -2088,7 +2100,7 @@ dependencies = [
"parking_lot",
"prometheus-client",
"quickcheck",
"rand",
"rand 0.9.0",
"tokio",
"tokio-test",
"tower",
Expand Down Expand Up @@ -2131,7 +2143,7 @@ dependencies = [
"linkerd-proxy-balance-queue",
"linkerd-proxy-core",
"linkerd-stack",
"rand",
"rand 0.9.0",
"tokio",
"tower",
"tracing",
Expand Down Expand Up @@ -2250,7 +2262,7 @@ dependencies = [
"linkerd-tracing",
"parking_lot",
"pin-project",
"rand",
"rand 0.9.0",
"thiserror 2.0.11",
"tokio",
"tokio-test",
Expand Down Expand Up @@ -2355,7 +2367,7 @@ dependencies = [
"pin-project",
"prost-types",
"quickcheck",
"rand",
"rand 0.9.0",
"thiserror 2.0.11",
"tokio",
"tonic",
Expand All @@ -2373,7 +2385,7 @@ dependencies = [
"linkerd-proxy-balance",
"linkerd-stack",
"pin-project",
"rand",
"rand 0.9.0",
"tokio",
"tower",
]
Expand Down Expand Up @@ -2551,7 +2563,7 @@ dependencies = [
"linkerd-dns",
"linkerd-tls",
"linkerd2-proxy-api",
"rand",
"rand 0.9.0",
"regex",
"thiserror 2.0.11",
"tracing",
Expand Down Expand Up @@ -2603,7 +2615,7 @@ dependencies = [
"http",
"linkerd-error",
"linkerd-stack",
"rand",
"rand 0.8.5",
"thiserror 1.0.69",
"tower",
"tracing",
Expand Down Expand Up @@ -2805,7 +2817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
"libc",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.52.0",
]

Expand Down Expand Up @@ -2984,7 +2996,7 @@ dependencies = [
"futures-util",
"opentelemetry",
"percent-encoding",
"rand",
"rand 0.8.5",
"thiserror 1.0.69",
]

Expand Down Expand Up @@ -3118,7 +3130,7 @@ version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
"zerocopy 0.7.35",
]

[[package]]
Expand Down Expand Up @@ -3250,7 +3262,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
dependencies = [
"rand",
"rand 0.8.5",
]

[[package]]
Expand All @@ -3269,8 +3281,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
]

[[package]]
name = "rand"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.0",
"zerocopy 0.8.14",
]

[[package]]
Expand All @@ -3280,7 +3303,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
"rand_core 0.6.4",
]

[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core 0.9.0",
]

[[package]]
Expand All @@ -3289,7 +3322,17 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
"getrandom 0.2.15",
]

[[package]]
name = "rand_core"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff"
dependencies = [
"getrandom 0.3.1",
"zerocopy 0.8.14",
]

[[package]]
Expand Down Expand Up @@ -3382,7 +3425,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"getrandom 0.2.15",
"libc",
"spin",
"untrusted",
Expand Down Expand Up @@ -3689,7 +3732,7 @@ checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704"
dependencies = [
"cfg-if",
"fastrand",
"getrandom",
"getrandom 0.2.15",
"once_cell",
"rustix",
"windows-sys 0.52.0",
Expand Down Expand Up @@ -3980,7 +4023,7 @@ dependencies = [
"indexmap 1.9.3",
"pin-project",
"pin-project-lite",
"rand",
"rand 0.8.5",
"slab",
"tokio",
"tokio-util",
Expand Down Expand Up @@ -4171,6 +4214,15 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasi"
version = "0.13.3+wasi-0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
dependencies = [
"wit-bindgen-rt",
]

[[package]]
name = "wasm-bindgen"
version = "0.2.93"
Expand Down Expand Up @@ -4396,6 +4448,15 @@ dependencies = [
"windows-sys 0.48.0",
]

[[package]]
name = "wit-bindgen-rt"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
"bitflags 2.4.2",
]

[[package]]
name = "write16"
version = "1.0.0"
Expand Down Expand Up @@ -4465,7 +4526,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
"zerocopy-derive 0.7.35",
]

[[package]]
name = "zerocopy"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468"
dependencies = [
"zerocopy-derive 0.8.14",
]

[[package]]
Expand All @@ -4479,6 +4549,17 @@ dependencies = [
"syn",
]

[[package]]
name = "zerocopy-derive"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "zerofrom"
version = "0.1.5"
Expand Down
3 changes: 3 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ skip = [
# Some dependencies still use indexmap v1.
{ name = "indexmap", version = "1" },
{ name = "hashbrown", version = "0.12" },

]
skip-tree = [
# thiserror v2 is still propagating through the ecosystem
{ name = "thiserror", version = "1" },
# rand 0.9 is still propagating through the ecosystem
{ name = "rand", version = "0.8" },
]

[sources]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/distribute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ahash = "0.8"
linkerd-stack = { path = "../stack" }
parking_lot = "0.12"
rand = { version = "0.8", features = ["small_rng"] }
rand = { version = "0.9", features = ["small_rng"] }
tokio = { version = "1", features = ["macros"] }
tracing = "0.1"

Expand Down
2 changes: 1 addition & 1 deletion linkerd/distribute/src/keys.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ahash::{HashMap, HashMapExt};
use rand::{
distributions::{WeightedError, WeightedIndex},
distr::weighted::{Error as WeightedError, WeightedIndex},
prelude::Distribution as _,
Rng,
};
Expand Down
3 changes: 1 addition & 2 deletions linkerd/distribute/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::{
WeightedServiceKeys,
};
use ahash::AHashSet;
use rand::distributions::WeightedError;
use std::{fmt::Debug, hash::Hash, sync::Arc};

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -73,7 +72,7 @@ impl<K> Distribution<K> {

pub fn random_available<T: IntoIterator<Item = (K, u32)>>(
iter: T,
) -> Result<Self, WeightedError> {
) -> Result<Self, rand::distr::weighted::Error> {
let weighted_keys = WeightedServiceKeys::new(
iter.into_iter()
.map(|(key, weight)| WeightedKey { key, weight }),
Expand Down
Loading

0 comments on commit 31d9e8f

Please sign in to comment.