rust: upgrade `rand*` crates
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 14 Jan 2022 10:25:45 -0800
changeset 48582 0dc698c91ca0
parent 48581 3b6b43a7ace4
child 48583 c91418480cb0
rust: upgrade `rand*` crates `test-check-cargo-lock.t` is failing for me and I was hoping this would help. It doesn't, but we might as well take the upgrade now that I've done the (small amount of) work for it. Differential Revision: https://phab.mercurial-scm.org/D12000
rust/Cargo.lock
rust/hg-core/Cargo.toml
rust/hg-core/src/dirstate_tree/on_disk.rs
rust/hg-core/tests/test_missing_ancestors.rs
--- a/rust/Cargo.lock	Thu Jan 06 22:09:40 2022 -0800
+++ b/rust/Cargo.lock	Fri Jan 14 10:25:45 2022 -0800
@@ -1,5 +1,7 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
 [[package]]
 name = "adler"
 version = "0.2.3"
@@ -354,6 +356,17 @@
 ]
 
 [[package]]
+name = "getrandom"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
+dependencies = [
+ "cfg-if 1.0.0",
+ "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+]
+
+[[package]]
 name = "glob"
 version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -395,7 +408,7 @@
  "memmap2",
  "micro-timer",
  "pretty_assertions",
- "rand",
+ "rand 0.8.4",
  "rand_distr",
  "rand_pcg",
  "rayon",
@@ -447,7 +460,7 @@
 checksum = "3ca8957e71f04a205cb162508f9326aea04676c8dfd0711220190d6b83664f3f"
 dependencies = [
  "bitmaps",
- "rand_core",
+ "rand_core 0.5.1",
  "rand_xoshiro",
  "sized-chunks",
  "typenum",
@@ -485,6 +498,12 @@
 checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
 
 [[package]]
+name = "libm"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
+
+[[package]]
 name = "libz-sys"
 version = "1.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -584,6 +603,7 @@
 checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
 dependencies = [
  "autocfg",
+ "libm",
 ]
 
 [[package]]
@@ -691,11 +711,23 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
 dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
  "libc",
- "rand_chacha",
- "rand_core",
- "rand_hc",
+ "rand_chacha 0.2.2",
+ "rand_core 0.5.1",
+ "rand_hc 0.2.0",
+]
+
+[[package]]
+name = "rand"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
+dependencies = [
+ "libc",
+ "rand_chacha 0.3.1",
+ "rand_core 0.6.3",
+ "rand_hc 0.3.1",
 ]
 
 [[package]]
@@ -705,7 +737,17 @@
 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
 dependencies = [
  "ppv-lite86",
- "rand_core",
+ "rand_core 0.5.1",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.6.3",
 ]
 
 [[package]]
@@ -714,16 +756,26 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
 dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
+dependencies = [
+ "getrandom 0.2.4",
 ]
 
 [[package]]
 name = "rand_distr"
-version = "0.2.2"
+version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
+checksum = "964d548f8e7d12e102ef183a0de7e98180c9f8729f555897a857b96e48122d2f"
 dependencies = [
- "rand",
+ "num-traits",
+ "rand 0.8.4",
 ]
 
 [[package]]
@@ -732,16 +784,25 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
 dependencies = [
- "rand_core",
+ "rand_core 0.5.1",
+]
+
+[[package]]
+name = "rand_hc"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
+dependencies = [
+ "rand_core 0.6.3",
 ]
 
 [[package]]
 name = "rand_pcg"
-version = "0.2.1"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
+checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e"
 dependencies = [
- "rand_core",
+ "rand_core 0.6.3",
 ]
 
 [[package]]
@@ -750,7 +811,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004"
 dependencies = [
- "rand_core",
+ "rand_core 0.5.1",
 ]
 
 [[package]]
@@ -904,7 +965,7 @@
 dependencies = [
  "cfg-if 0.1.10",
  "libc",
- "rand",
+ "rand 0.7.3",
  "redox_syscall",
  "remove_dir_all",
  "winapi",
@@ -955,7 +1016,7 @@
 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
 dependencies = [
  "cfg-if 0.1.10",
- "rand",
+ "rand 0.7.3",
  "static_assertions",
 ]
 
@@ -1000,7 +1061,7 @@
 checksum = "4cb68c231e2575f7503a7c19213875f9d4ec2e84e963a56ce3de4b6bee351ef7"
 dependencies = [
  "hex",
- "rand",
+ "rand 0.7.3",
  "sha-1",
 ]
 
--- a/rust/hg-core/Cargo.toml	Thu Jan 06 22:09:40 2022 -0800
+++ b/rust/hg-core/Cargo.toml	Fri Jan 14 10:25:45 2022 -0800
@@ -18,9 +18,9 @@
 itertools = "0.9"
 lazy_static = "1.4.0"
 libc = "0.2"
-rand = "0.7.3"
-rand_pcg = "0.2.1"
-rand_distr = "0.2.2"
+rand = "0.8.4"
+rand_pcg = "0.3.1"
+rand_distr = "0.4.2"
 rayon = "1.3.0"
 regex = "1.3.9"
 sha-1 = "0.9.6"
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs	Thu Jan 06 22:09:40 2022 -0800
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs	Fri Jan 14 10:25:45 2022 -0800
@@ -207,7 +207,7 @@
             // One random hexadecimal digit.
             // `unwrap` never panics because `impl Write for String`
             // never returns an error.
-            write!(&mut id, "{:x}", rng.gen_range(0, 16)).unwrap();
+            write!(&mut id, "{:x}", rng.gen_range(0..16)).unwrap();
         }
         id
     }
--- a/rust/hg-core/tests/test_missing_ancestors.rs	Thu Jan 06 22:09:40 2022 -0800
+++ b/rust/hg-core/tests/test_missing_ancestors.rs	Fri Jan 14 10:25:45 2022 -0800
@@ -32,11 +32,11 @@
                 if i == 2 || rng.gen_bool(prevprob) {
                     (i - 1) as Revision
                 } else {
-                    rng.gen_range(0, i - 1) as Revision
+                    rng.gen_range(0..i - 1) as Revision
                 }
             };
             // p2 is a random revision lower than i and different from p1
-            let mut p2 = rng.gen_range(0, i - 1) as Revision;
+            let mut p2 = rng.gen_range(0..i - 1) as Revision;
             if p2 >= p1 {
                 p2 = p2 + 1;
             }
@@ -44,7 +44,7 @@
         } else if rng.gen_bool(prevprob) {
             vg.push([(i - 1) as Revision, NULL_REVISION])
         } else {
-            vg.push([rng.gen_range(0, i - 1) as Revision, NULL_REVISION])
+            vg.push([rng.gen_range(0..i - 1) as Revision, NULL_REVISION])
         }
     }
     vg