From cd640b1143abbcc541c1a6b51f3c1a8d8245753d Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 3 Sep 2025 09:34:01 +0100 Subject: [PATCH 1/4] Add test for rand_core MSRV --- .github/workflows/test.yml | 19 + rand_core/Cargo.lock.msrv | 728 +++++++++++++++++++++++++++++++++++++ 2 files changed, 747 insertions(+) create mode 100644 rand_core/Cargo.lock.msrv diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad0cf1425cc..86ea2ca8830 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,6 +50,25 @@ jobs: - name: rand_pcg run: cargo doc --all-features --package rand_pcg --no-deps + core-msrv: + name: rand_core MSRV + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: MSRV + run: | + rm Cargo.toml + cd rand_core + cp Cargo.lock.msrv Cargo.lock + - name: Install toolchain + uses: dtolnay/rust-toolchain@1.63.0 + - name: Test rand_core + working-directory: ./rand_core + run: | + cargo test + cargo test --no-default-features + cargo test --no-default-features --features=os_rng + test: runs-on: ${{ matrix.os }} strategy: diff --git a/rand_core/Cargo.lock.msrv b/rand_core/Cargo.lock.msrv new file mode 100644 index 00000000000..66921820c1e --- /dev/null +++ b/rand_core/Cargo.lock.msrv @@ -0,0 +1,728 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "average" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a237a6822e1c3c98e700b6db5b293eb341b7524dcb8d227941245702b7431dc" +dependencies = [ + "easy-cast", + "float-ord", + "num-traits", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" + +[[package]] +name = "cc" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "crossbeam-channel" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "darling" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "easy-cast" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10936778145f3bea71fd9bf61332cce28c28e96a380714f7ab34838b80733fd6" +dependencies = [ + "libm", +] + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "fast_polynomial" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62eea6ee590b08a5f8b1139f4d6caee195b646d0c07e4b1808fbd5c4dea4829a" +dependencies = [ + "num-traits", +] + +[[package]] +name = "float-ord" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lambert_w" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8852c2190439a46c77861aca230080cc9db4064be7f9de8ee81816d6c72c25" +dependencies = [ + "fast_polynomial", + "libm", +] + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.9.0-beta.0" +dependencies = [ + "bincode", + "log", + "rand_chacha", + "rand_core", + "rand_pcg", + "rayon", + "serde", + "zerocopy", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0-beta.0" +dependencies = [ + "ppv-lite86", + "rand_core", + "serde", + "serde_json", +] + +[[package]] +name = "rand_core" +version = "0.9.0-beta.0" +dependencies = [ + "getrandom", + "serde", + "zerocopy", +] + +[[package]] +name = "rand_distr" +version = "0.5.0-beta.0" +dependencies = [ + "average", + "num-traits", + "rand", + "rand_pcg", + "serde", + "serde_with", + "special", +] + +[[package]] +name = "rand_pcg" +version = "0.9.0-beta.0" +dependencies = [ + "bincode", + "rand_core", + "serde", +] + +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "ryu" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "serde" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "special" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d279079c3ddec4e7851337070c1055a18b8f606bba0b1aeb054bc059fc2e27" +dependencies = [ + "lambert_w", + "libm", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "2.0.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "time" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + +[[package]] +name = "zerocopy" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65238aacd5fb83fb03fcaf94823e71643e937000ec03c46e7da94234b10c870" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ca22c4ad176b37bd81a565f66635bde3d654fe6832730c3e52e1018ae1655ee" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] From 081e9da8a47fac93e4f6de172ccc892ac89ee011 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Tue, 12 Aug 2025 14:05:56 +0100 Subject: [PATCH 2/4] Bump the MSRV to 1.85 --- .github/workflows/test.yml | 2 +- CHANGELOG.md | 9 +- Cargo.lock.msrv | 590 +++++-------------------------------- Cargo.toml | 2 +- rand_pcg/CHANGELOG.md | 4 + rand_pcg/Cargo.toml | 2 +- 6 files changed, 82 insertions(+), 527 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86ea2ca8830..46d265490d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,7 @@ jobs: - os: ubuntu-latest target: x86_64-unknown-linux-gnu variant: MSRV - toolchain: 1.63.0 + toolchain: 1.85.0 - os: ubuntu-latest deps: sudo apt-get update ; sudo apt install gcc-multilib target: i686-unknown-linux-gnu diff --git a/CHANGELOG.md b/CHANGELOG.md index e2c979cde77..c0ce4473fda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,14 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md). You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful. -## [Unreleased] -### Additions -- Pub export `Xoshiro128PlusPlus`, `Xoshiro256PlusPlus` prngs (#1649) - +## [0.10.0 — Unreleased] ### Changes +- Bump the MSRV to 1.85 (#1653) - Let `Fill` be implemented for element types, not sliceable types (#1652) +### Additions +- Pub export `Xoshiro128PlusPlus`, `Xoshiro256PlusPlus` prngs (#1649) + ## [0.9.2 — 2025-07-20] ### Deprecated - Deprecate `rand::rngs::mock` module and `StepRng` generator (#1634) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 66921820c1e..ea3e5407289 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -2,44 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "average" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a237a6822e1c3c98e700b6db5b293eb341b7524dcb8d227941245702b7431dc" -dependencies = [ - "easy-cast", - "float-ord", - "num-traits", -] - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "bincode" version = "1.3.3" @@ -50,56 +12,22 @@ dependencies = [ ] [[package]] -name = "bumpalo" -version = "3.15.4" +name = "bitflags" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" - -[[package]] -name = "cc" -version = "1.0.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "serde", - "windows-targets", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "crossbeam-channel" -version = "0.5.12" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" -dependencies = [ - "crossbeam-utils", -] +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -116,268 +44,88 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "darling" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.8" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", - "serde", -] - -[[package]] -name = "easy-cast" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10936778145f3bea71fd9bf61332cce28c28e96a380714f7ab34838b80733fd6" -dependencies = [ - "libm", -] +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "either" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" - -[[package]] -name = "fast_polynomial" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62eea6ee590b08a5f8b1139f4d6caee195b646d0c07e4b1808fbd5c4dea4829a" -dependencies = [ - "num-traits", -] - -[[package]] -name = "float-ord" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" - -[[package]] -name = "fnv" -version = "1.0.7" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "getrandom" -version = "0.2.12" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", + "r-efi", "wasi", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - [[package]] name = "itoa" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "js-sys" -version = "0.3.69" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lambert_w" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8852c2190439a46c77861aca230080cc9db4064be7f9de8ee81816d6c72c25" -dependencies = [ - "fast_polynomial", - "libm", -] +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "log" -version = "0.4.21" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] -name = "num-conv" -version = "0.1.0" +name = "memchr" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] -name = "num-traits" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" +name = "ppv-lite86" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "hermit-abi", - "libc", + "zerocopy", ] -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "rand" -version = "0.9.0-beta.0" +version = "0.9.2" dependencies = [ "bincode", "log", @@ -386,12 +134,12 @@ dependencies = [ "rand_pcg", "rayon", "serde", - "zerocopy", + "serde_json", ] [[package]] name = "rand_chacha" -version = "0.9.0-beta.0" +version = "0.9.0" dependencies = [ "ppv-lite86", "rand_core", @@ -401,29 +149,15 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.0-beta.0" +version = "0.9.3" dependencies = [ "getrandom", "serde", - "zerocopy", -] - -[[package]] -name = "rand_distr" -version = "0.5.0-beta.0" -dependencies = [ - "average", - "num-traits", - "rand", - "rand_pcg", - "serde", - "serde_with", - "special", ] [[package]] name = "rand_pcg" -version = "0.9.0-beta.0" +version = "0.9.0" dependencies = [ "bincode", "rand_core", @@ -432,9 +166,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -442,36 +176,34 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -480,247 +212,65 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] -[[package]] -name = "serde_with" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "special" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98d279079c3ddec4e7851337070c1055a18b8f606bba0b1aeb054bc059fc2e27" -dependencies = [ - "lambert_w", - "libm", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "syn" -version = "2.0.53" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "time" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "wit-bindgen-rt", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" +name = "wit-bindgen-rt" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "bitflags", ] -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" - [[package]] name = "zerocopy" -version = "0.8.6" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65238aacd5fb83fb03fcaf94823e71643e937000ec03c46e7da94234b10c870" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.6" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ca22c4ad176b37bd81a565f66635bde3d654fe6832730c3e52e1018ae1655ee" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index cd8c2197338..2106b97492b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["random", "rng"] categories = ["algorithms", "no-std"] autobenches = true edition = "2021" -rust-version = "1.63" +rust-version = "1.85" include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"] [package.metadata.docs.rs] diff --git a/rand_pcg/CHANGELOG.md b/rand_pcg/CHANGELOG.md index bab1cd0e8c8..f6da331b13d 100644 --- a/rand_pcg/CHANGELOG.md +++ b/rand_pcg/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.0 — Unreleased] +### Changes +- Bump the MSRV to 1.85 (#1653) + ## [0.9.0] - 2025-01-27 ### Dependencies and features - Update to `rand_core` v0.9.0 (#1558) diff --git a/rand_pcg/Cargo.toml b/rand_pcg/Cargo.toml index 74740950712..b17cf19c5f1 100644 --- a/rand_pcg/Cargo.toml +++ b/rand_pcg/Cargo.toml @@ -13,7 +13,7 @@ Selected PCG random number generators keywords = ["random", "rng", "pcg"] categories = ["algorithms", "no-std"] edition = "2021" -rust-version = "1.63" +rust-version = "1.85" [package.metadata.docs.rs] all-features = true From 57eaa4dafb95088dfb3e626f6705767165094ccf Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Tue, 12 Aug 2025 14:47:08 +0100 Subject: [PATCH 3/4] Migrate to edition 2024 --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- benches/Cargo.toml | 2 +- rand_pcg/CHANGELOG.md | 2 +- rand_pcg/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0ce4473fda..1055d4dde69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update. ## [0.10.0 — Unreleased] ### Changes -- Bump the MSRV to 1.85 (#1653) +- Use Edition 2024 and MSRV 1.85 (#1653) - Let `Fill` be implemented for element types, not sliceable types (#1652) ### Additions diff --git a/Cargo.toml b/Cargo.toml index 2106b97492b..d9dc110c25b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ Random number generators and other randomness functionality. keywords = ["random", "rng"] categories = ["algorithms", "no-std"] autobenches = true -edition = "2021" +edition = "2024" rust-version = "1.85" include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"] diff --git a/benches/Cargo.toml b/benches/Cargo.toml index adb9aadd84b..699186b26fd 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "benches" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [features] diff --git a/rand_pcg/CHANGELOG.md b/rand_pcg/CHANGELOG.md index f6da331b13d..421803d9b9a 100644 --- a/rand_pcg/CHANGELOG.md +++ b/rand_pcg/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.10.0 — Unreleased] ### Changes -- Bump the MSRV to 1.85 (#1653) +- Use Edition 2024 and MSRV 1.85 (#1653) ## [0.9.0] - 2025-01-27 ### Dependencies and features diff --git a/rand_pcg/Cargo.toml b/rand_pcg/Cargo.toml index b17cf19c5f1..5056fca8537 100644 --- a/rand_pcg/Cargo.toml +++ b/rand_pcg/Cargo.toml @@ -12,7 +12,7 @@ Selected PCG random number generators """ keywords = ["random", "rng", "pcg"] categories = ["algorithms", "no-std"] -edition = "2021" +edition = "2024" rust-version = "1.85" [package.metadata.docs.rs] From 000680442fc8df1960ebca1c23a1216f7f5cb52d Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Tue, 12 Aug 2025 14:47:22 +0100 Subject: [PATCH 4/4] Update formatting --- benches/benches/array.rs | 2 +- benches/benches/bool.rs | 2 +- benches/benches/generators.rs | 4 +- benches/benches/seq_choose.rs | 4 +- benches/benches/shuffle.rs | 4 +- benches/benches/simd.rs | 2 +- benches/benches/standard.rs | 2 +- benches/benches/uniform.rs | 4 +- benches/benches/uniform_float.rs | 2 +- benches/benches/weighted.rs | 2 +- examples/monty-hall.rs | 2 +- examples/rayon-monte-carlo.rs | 160 +++++++++++++-------------- rand_pcg/src/lib.rs | 2 +- rand_pcg/src/pcg128.rs | 2 +- rand_pcg/src/pcg128cm.rs | 2 +- rand_pcg/src/pcg64.rs | 2 +- src/distr/bernoulli.rs | 8 +- src/distr/distribution.rs | 2 +- src/distr/float.rs | 2 +- src/distr/integer.rs | 6 +- src/distr/other.rs | 2 +- src/distr/slice.rs | 2 +- src/distr/uniform_float.rs | 4 +- src/distr/uniform_int.rs | 10 +- src/distr/uniform_other.rs | 6 +- src/distr/weighted/weighted_index.rs | 4 +- src/rngs/mock.rs | 2 +- src/rngs/mod.rs | 2 +- src/rngs/reseeding.rs | 2 +- src/seq/index.rs | 2 +- src/seq/iterator.rs | 10 +- src/seq/slice.rs | 6 +- 32 files changed, 136 insertions(+), 132 deletions(-) diff --git a/benches/benches/array.rs b/benches/benches/array.rs index 063516337bf..2a4baf2086e 100644 --- a/benches/benches/array.rs +++ b/benches/benches/array.rs @@ -8,7 +8,7 @@ //! Generating/filling arrays and iterators of output -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, criterion_group, criterion_main}; use rand::distr::StandardUniform; use rand::prelude::*; use rand_pcg::Pcg64Mcg; diff --git a/benches/benches/bool.rs b/benches/benches/bool.rs index 8ff8c676024..0625eea8714 100644 --- a/benches/benches/bool.rs +++ b/benches/benches/bool.rs @@ -8,7 +8,7 @@ //! Generating/filling arrays and iterators of output -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, criterion_group, criterion_main}; use rand::distr::Bernoulli; use rand::prelude::*; use rand_pcg::Pcg32; diff --git a/benches/benches/generators.rs b/benches/benches/generators.rs index c45e1408fcf..1d22b1aa6c7 100644 --- a/benches/benches/generators.rs +++ b/benches/benches/generators.rs @@ -8,12 +8,12 @@ use core::time::Duration; use criterion::measurement::WallTime; -use criterion::{black_box, criterion_group, criterion_main, BenchmarkGroup, Criterion}; +use criterion::{BenchmarkGroup, Criterion, black_box, criterion_group, criterion_main}; use rand::prelude::*; use rand::rngs::OsRng; use rand::rngs::ReseedingRng; use rand_chacha::rand_core::UnwrapErr; -use rand_chacha::{ChaCha12Rng, ChaCha20Core, ChaCha20Rng, ChaCha8Rng}; +use rand_chacha::{ChaCha8Rng, ChaCha12Rng, ChaCha20Core, ChaCha20Rng}; use rand_pcg::{Pcg32, Pcg64, Pcg64Dxsm, Pcg64Mcg}; criterion_group!( diff --git a/benches/benches/seq_choose.rs b/benches/benches/seq_choose.rs index da3a46c109e..37800fe99db 100644 --- a/benches/benches/seq_choose.rs +++ b/benches/benches/seq_choose.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use rand::prelude::*; +use criterion::{Criterion, black_box, criterion_group, criterion_main}; use rand::SeedableRng; +use rand::prelude::*; use rand_pcg::Pcg32; criterion_group!( diff --git a/benches/benches/shuffle.rs b/benches/benches/shuffle.rs index c2f37daaeab..f2ccff2e877 100644 --- a/benches/benches/shuffle.rs +++ b/benches/benches/shuffle.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use rand::prelude::*; +use criterion::{Criterion, black_box, criterion_group, criterion_main}; use rand::SeedableRng; +use rand::prelude::*; use rand_pcg::Pcg32; criterion_group!( diff --git a/benches/benches/simd.rs b/benches/benches/simd.rs index f1723245977..1515125c64c 100644 --- a/benches/benches/simd.rs +++ b/benches/benches/simd.rs @@ -10,7 +10,7 @@ #![cfg_attr(feature = "simd_support", feature(portable_simd))] -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, criterion_group, criterion_main}; criterion_group!( name = benches; diff --git a/benches/benches/standard.rs b/benches/benches/standard.rs index de95fb5ba69..5bd74020afb 100644 --- a/benches/benches/standard.rs +++ b/benches/benches/standard.rs @@ -8,7 +8,7 @@ use core::time::Duration; use criterion::measurement::WallTime; -use criterion::{criterion_group, criterion_main, BenchmarkGroup, Criterion}; +use criterion::{BenchmarkGroup, Criterion, criterion_group, criterion_main}; use rand::distr::{Alphabetic, Alphanumeric, Open01, OpenClosed01, StandardUniform}; use rand::prelude::*; use rand_pcg::Pcg64Mcg; diff --git a/benches/benches/uniform.rs b/benches/benches/uniform.rs index 1f1ed49681d..f995b934e8d 100644 --- a/benches/benches/uniform.rs +++ b/benches/benches/uniform.rs @@ -11,13 +11,13 @@ #![cfg_attr(feature = "simd_support", feature(portable_simd))] use core::time::Duration; -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main}; use rand::distr::uniform::{SampleRange, Uniform}; use rand::prelude::*; use rand_chacha::ChaCha8Rng; use rand_pcg::{Pcg32, Pcg64}; #[cfg(feature = "simd_support")] -use std::simd::{num::SimdUint, Simd}; +use std::simd::{Simd, num::SimdUint}; const WARM_UP_TIME: Duration = Duration::from_millis(1000); const MEASUREMENT_TIME: Duration = Duration::from_secs(3); diff --git a/benches/benches/uniform_float.rs b/benches/benches/uniform_float.rs index 03a434fc228..ee9441627e8 100644 --- a/benches/benches/uniform_float.rs +++ b/benches/benches/uniform_float.rs @@ -13,7 +13,7 @@ //! - sample: current method: (x12 - 1.0) * (b - a) + a use core::time::Duration; -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main}; use rand::distr::uniform::{SampleUniform, Uniform, UniformSampler}; use rand::prelude::*; use rand_chacha::ChaCha8Rng; diff --git a/benches/benches/weighted.rs b/benches/benches/weighted.rs index 16bfdc966ff..115883c5b2e 100644 --- a/benches/benches/weighted.rs +++ b/benches/benches/weighted.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, black_box, criterion_group, criterion_main}; use rand::distr::weighted::WeightedIndex; use rand::prelude::*; use rand::seq::index::sample_weighted; diff --git a/examples/monty-hall.rs b/examples/monty-hall.rs index 0a6d033739c..d8930c6645e 100644 --- a/examples/monty-hall.rs +++ b/examples/monty-hall.rs @@ -26,8 +26,8 @@ //! //! [Monty Hall Problem]: https://en.wikipedia.org/wiki/Monty_Hall_problem -use rand::distr::{Distribution, Uniform}; use rand::Rng; +use rand::distr::{Distribution, Uniform}; struct SimulationResult { win: bool, diff --git a/examples/rayon-monte-carlo.rs b/examples/rayon-monte-carlo.rs index 31d8e681067..df89f36668a 100644 --- a/examples/rayon-monte-carlo.rs +++ b/examples/rayon-monte-carlo.rs @@ -1,80 +1,80 @@ -// Copyright 2018 Developers of the Rand project. -// Copyright 2013-2018 The Rust Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! # Monte Carlo estimation of π with a chosen seed and rayon for parallelism -//! -//! Imagine that we have a square with sides of length 2 and a unit circle -//! (radius = 1), both centered at the origin. The areas are: -//! -//! ```text -//! area of circle = πr² = π * r * r = π -//! area of square = 2² = 4 -//! ``` -//! -//! The circle is entirely within the square, so if we sample many points -//! randomly from the square, roughly π / 4 of them should be inside the circle. -//! -//! We can use the above fact to estimate the value of π: pick many points in -//! the square at random, calculate the fraction that fall within the circle, -//! and multiply this fraction by 4. -//! -//! Note on determinism: -//! It's slightly tricky to build a parallel simulation using Rayon -//! which is both efficient *and* reproducible. -//! -//! Rayon's ParallelIterator api does not guarantee that the work will be -//! batched into identical batches on every run, so we can't simply use -//! map_init to construct one RNG per Rayon batch. -//! -//! Instead, we do our own batching, so that a Rayon work item becomes a -//! batch. Then we can fix our rng stream to the batched work item. -//! Batching amortizes the cost of constructing the Rng from a fixed seed -//! over BATCH_SIZE trials. Manually batching also turns out to be faster -//! for the nondeterministic version of this program as well. - -use rand::distr::{Distribution, Uniform}; -use rand_chacha::{rand_core::SeedableRng, ChaCha8Rng}; -use rayon::prelude::*; - -static SEED: u64 = 0; -static BATCH_SIZE: u64 = 10_000; -static BATCHES: u64 = 1000; - -fn main() { - let range = Uniform::new(-1.0f64, 1.0).unwrap(); - - let in_circle = (0..BATCHES) - .into_par_iter() - .map(|i| { - let mut rng = ChaCha8Rng::seed_from_u64(SEED); - // We chose ChaCha because it's fast, has suitable statistical properties for simulation, - // and because it supports this set_stream() api, which lets us choose a different stream - // per work item. ChaCha supports 2^64 independent streams. - rng.set_stream(i); - let mut count = 0; - for _ in 0..BATCH_SIZE { - let a = range.sample(&mut rng); - let b = range.sample(&mut rng); - if a * a + b * b <= 1.0 { - count += 1; - } - } - count - }) - .sum::(); - - // assert this is deterministic - assert_eq!(in_circle, 7852263); - - // prints something close to 3.14159... - println!( - "π is approximately {}", - 4. * (in_circle as f64) / ((BATCH_SIZE * BATCHES) as f64) - ); -} +// Copyright 2018 Developers of the Rand project. +// Copyright 2013-2018 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! # Monte Carlo estimation of π with a chosen seed and rayon for parallelism +//! +//! Imagine that we have a square with sides of length 2 and a unit circle +//! (radius = 1), both centered at the origin. The areas are: +//! +//! ```text +//! area of circle = πr² = π * r * r = π +//! area of square = 2² = 4 +//! ``` +//! +//! The circle is entirely within the square, so if we sample many points +//! randomly from the square, roughly π / 4 of them should be inside the circle. +//! +//! We can use the above fact to estimate the value of π: pick many points in +//! the square at random, calculate the fraction that fall within the circle, +//! and multiply this fraction by 4. +//! +//! Note on determinism: +//! It's slightly tricky to build a parallel simulation using Rayon +//! which is both efficient *and* reproducible. +//! +//! Rayon's ParallelIterator api does not guarantee that the work will be +//! batched into identical batches on every run, so we can't simply use +//! map_init to construct one RNG per Rayon batch. +//! +//! Instead, we do our own batching, so that a Rayon work item becomes a +//! batch. Then we can fix our rng stream to the batched work item. +//! Batching amortizes the cost of constructing the Rng from a fixed seed +//! over BATCH_SIZE trials. Manually batching also turns out to be faster +//! for the nondeterministic version of this program as well. + +use rand::distr::{Distribution, Uniform}; +use rand_chacha::{ChaCha8Rng, rand_core::SeedableRng}; +use rayon::prelude::*; + +static SEED: u64 = 0; +static BATCH_SIZE: u64 = 10_000; +static BATCHES: u64 = 1000; + +fn main() { + let range = Uniform::new(-1.0f64, 1.0).unwrap(); + + let in_circle = (0..BATCHES) + .into_par_iter() + .map(|i| { + let mut rng = ChaCha8Rng::seed_from_u64(SEED); + // We chose ChaCha because it's fast, has suitable statistical properties for simulation, + // and because it supports this set_stream() api, which lets us choose a different stream + // per work item. ChaCha supports 2^64 independent streams. + rng.set_stream(i); + let mut count = 0; + for _ in 0..BATCH_SIZE { + let a = range.sample(&mut rng); + let b = range.sample(&mut rng); + if a * a + b * b <= 1.0 { + count += 1; + } + } + count + }) + .sum::(); + + // assert this is deterministic + assert_eq!(in_circle, 7852263); + + // prints something close to 3.14159... + println!( + "π is approximately {}", + 4. * (in_circle as f64) / ((BATCH_SIZE * BATCHES) as f64) + ); +} diff --git a/rand_pcg/src/lib.rs b/rand_pcg/src/lib.rs index 6b9d9d833f0..300d6bbc404 100644 --- a/rand_pcg/src/lib.rs +++ b/rand_pcg/src/lib.rs @@ -95,6 +95,6 @@ mod pcg64; pub use rand_core; +pub use self::pcg64::{Lcg64Xsh32, Pcg32}; pub use self::pcg128::{Lcg128Xsl64, Mcg128Xsl64, Pcg64, Pcg64Mcg}; pub use self::pcg128cm::{Lcg128CmDxsm64, Pcg64Dxsm}; -pub use self::pcg64::{Lcg64Xsh32, Pcg32}; diff --git a/rand_pcg/src/pcg128.rs b/rand_pcg/src/pcg128.rs index d2341425673..8e8c437741d 100644 --- a/rand_pcg/src/pcg128.rs +++ b/rand_pcg/src/pcg128.rs @@ -14,7 +14,7 @@ const MULTIPLIER: u128 = 0x2360_ED05_1FC6_5DA4_4385_DF64_9FCC_F645; use core::fmt; -use rand_core::{impls, le, RngCore, SeedableRng}; +use rand_core::{RngCore, SeedableRng, impls, le}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/rand_pcg/src/pcg128cm.rs b/rand_pcg/src/pcg128cm.rs index a5a2b178795..6f010f13156 100644 --- a/rand_pcg/src/pcg128cm.rs +++ b/rand_pcg/src/pcg128cm.rs @@ -14,7 +14,7 @@ const MULTIPLIER: u64 = 15750249268501108917; use core::fmt; -use rand_core::{impls, le, RngCore, SeedableRng}; +use rand_core::{RngCore, SeedableRng, impls, le}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/rand_pcg/src/pcg64.rs b/rand_pcg/src/pcg64.rs index 771a996d28f..9281147a5e2 100644 --- a/rand_pcg/src/pcg64.rs +++ b/rand_pcg/src/pcg64.rs @@ -11,7 +11,7 @@ //! PCG random number generators use core::fmt; -use rand_core::{impls, le, RngCore, SeedableRng}; +use rand_core::{RngCore, SeedableRng, impls, le}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/src/distr/bernoulli.rs b/src/distr/bernoulli.rs index 6803518e376..e457dd7dd48 100644 --- a/src/distr/bernoulli.rs +++ b/src/distr/bernoulli.rs @@ -8,8 +8,8 @@ //! The Bernoulli distribution `Bernoulli(p)`. -use crate::distr::Distribution; use crate::Rng; +use crate::distr::Distribution; use core::fmt; #[cfg(feature = "serde")] @@ -165,8 +165,8 @@ impl Distribution for Bernoulli { #[cfg(test)] mod test { use super::Bernoulli; - use crate::distr::Distribution; use crate::Rng; + use crate::distr::Distribution; #[test] #[cfg(feature = "serde")] @@ -232,7 +232,9 @@ mod test { } assert_eq!( buf, - [true, false, false, true, false, false, true, true, true, true] + [ + true, false, false, true, false, false, true, true, true, true + ] ); } diff --git a/src/distr/distribution.rs b/src/distr/distribution.rs index 48598ec0fde..d96e6cd841f 100644 --- a/src/distr/distribution.rs +++ b/src/distr/distribution.rs @@ -203,8 +203,8 @@ pub trait SampleString { #[cfg(test)] mod tests { - use crate::distr::{Distribution, Uniform}; use crate::Rng; + use crate::distr::{Distribution, Uniform}; #[test] fn test_distributions_iter() { diff --git a/src/distr/float.rs b/src/distr/float.rs index 44c33e99268..968144692f2 100644 --- a/src/distr/float.rs +++ b/src/distr/float.rs @@ -8,9 +8,9 @@ //! Basic floating-point number distributions +use crate::Rng; use crate::distr::utils::{FloatAsSIMD, FloatSIMDUtils, IntAsSIMD}; use crate::distr::{Distribution, StandardUniform}; -use crate::Rng; use core::mem; #[cfg(feature = "simd_support")] use core::simd::prelude::*; diff --git a/src/distr/integer.rs b/src/distr/integer.rs index 37b2081c471..e5147eb5288 100644 --- a/src/distr/integer.rs +++ b/src/distr/integer.rs @@ -8,8 +8,8 @@ //! The implementations of the `StandardUniform` distribution for integer types. -use crate::distr::{Distribution, StandardUniform}; use crate::Rng; +use crate::distr::{Distribution, StandardUniform}; #[cfg(all(target_arch = "x86", feature = "simd_support"))] use core::arch::x86::__m512i; #[cfg(target_arch = "x86")] @@ -19,8 +19,8 @@ use core::arch::x86_64::__m512i; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::{__m128i, __m256i}; use core::num::{ - NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroU128, NonZeroU16, - NonZeroU32, NonZeroU64, NonZeroU8, + NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroU8, NonZeroU16, NonZeroU32, + NonZeroU64, NonZeroU128, }; #[cfg(feature = "simd_support")] use core::simd::*; diff --git a/src/distr/other.rs b/src/distr/other.rs index 47b99323d6b..09be2e488c0 100644 --- a/src/distr/other.rs +++ b/src/distr/other.rs @@ -14,10 +14,10 @@ use core::array; use core::char; use core::num::Wrapping; +use crate::Rng; #[cfg(feature = "alloc")] use crate::distr::SampleString; use crate::distr::{Distribution, StandardUniform, Uniform}; -use crate::Rng; #[cfg(feature = "simd_support")] use core::simd::prelude::*; diff --git a/src/distr/slice.rs b/src/distr/slice.rs index 07e243fec5d..706d3303943 100644 --- a/src/distr/slice.rs +++ b/src/distr/slice.rs @@ -10,8 +10,8 @@ use core::num::NonZeroUsize; -use crate::distr::uniform::{UniformSampler, UniformUsize}; use crate::distr::Distribution; +use crate::distr::uniform::{UniformSampler, UniformUsize}; #[cfg(feature = "alloc")] use alloc::string::String; diff --git a/src/distr/uniform_float.rs b/src/distr/uniform_float.rs index e9b0421aaf0..7b21f35454c 100644 --- a/src/distr/uniform_float.rs +++ b/src/distr/uniform_float.rs @@ -10,9 +10,9 @@ //! `UniformFloat` implementation use super::{Error, SampleBorrow, SampleUniform, UniformSampler}; +use crate::Rng; use crate::distr::float::IntoFloat; use crate::distr::utils::{BoolAsSIMD, FloatAsSIMD, FloatSIMDUtils, IntAsSIMD}; -use crate::Rng; #[cfg(feature = "simd_support")] use core::simd::prelude::*; @@ -218,7 +218,7 @@ uniform_float_impl! { feature = "simd_support", f64x8, u64x8, f64, u64, 64 - 52 #[cfg(test)] mod tests { use super::*; - use crate::distr::{utils::FloatSIMDScalarUtils, Uniform}; + use crate::distr::{Uniform, utils::FloatSIMDScalarUtils}; use crate::test::{const_rng, step_rng}; #[test] diff --git a/src/distr/uniform_int.rs b/src/distr/uniform_int.rs index 4a83c1360b7..e4f4cfa3f85 100644 --- a/src/distr/uniform_int.rs +++ b/src/distr/uniform_int.rs @@ -10,10 +10,10 @@ //! `UniformInt` implementation use super::{Error, SampleBorrow, SampleUniform, UniformSampler}; +use crate::Rng; use crate::distr::utils::WideningMultiply; #[cfg(feature = "simd_support")] use crate::distr::{Distribution, StandardUniform}; -use crate::Rng; #[cfg(feature = "simd_support")] use core::simd::prelude::*; @@ -89,7 +89,7 @@ macro_rules! uniform_int_impl { type X = $ty; #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. + // calculations at compile-time. fn new(low_b: B1, high_b: B2) -> Result where B1: SampleBorrow + Sized, @@ -104,7 +104,7 @@ macro_rules! uniform_int_impl { } #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. + // calculations at compile-time. fn new_inclusive(low_b: B1, high_b: B2) -> Result where B1: SampleBorrow + Sized, @@ -437,7 +437,7 @@ impl UniformSampler for UniformUsize { type X = usize; #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. + // calculations at compile-time. fn new(low_b: B1, high_b: B2) -> Result where B1: SampleBorrow + Sized, @@ -453,7 +453,7 @@ impl UniformSampler for UniformUsize { } #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. + // calculations at compile-time. fn new_inclusive(low_b: B1, high_b: B2) -> Result where B1: SampleBorrow + Sized, diff --git a/src/distr/uniform_other.rs b/src/distr/uniform_other.rs index 03533debcd8..91059f8944c 100644 --- a/src/distr/uniform_other.rs +++ b/src/distr/uniform_other.rs @@ -10,8 +10,8 @@ //! `UniformChar`, `UniformDuration` implementations use super::{Error, SampleBorrow, SampleUniform, Uniform, UniformInt, UniformSampler}; -use crate::distr::Distribution; use crate::Rng; +use crate::distr::Distribution; use core::time::Duration; #[cfg(feature = "serde")] @@ -53,7 +53,7 @@ impl UniformSampler for UniformChar { type X = char; #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. + // calculations at compile-time. fn new(low_b: B1, high_b: B2) -> Result where B1: SampleBorrow + Sized, @@ -66,7 +66,7 @@ impl UniformSampler for UniformChar { } #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. + // calculations at compile-time. fn new_inclusive(low_b: B1, high_b: B2) -> Result where B1: SampleBorrow + Sized, diff --git a/src/distr/weighted/weighted_index.rs b/src/distr/weighted/weighted_index.rs index 4bb9d141fb3..da14781456f 100644 --- a/src/distr/weighted/weighted_index.rs +++ b/src/distr/weighted/weighted_index.rs @@ -7,9 +7,9 @@ // except according to those terms. use super::{Error, Weight}; -use crate::distr::uniform::{SampleBorrow, SampleUniform, UniformSampler}; -use crate::distr::Distribution; use crate::Rng; +use crate::distr::Distribution; +use crate::distr::uniform::{SampleBorrow, SampleUniform, UniformSampler}; // Note that this whole module is only imported if feature="alloc" is enabled. use alloc::vec::Vec; diff --git a/src/rngs/mock.rs b/src/rngs/mock.rs index 5b6a2253b18..6c2dd74ee7a 100644 --- a/src/rngs/mock.rs +++ b/src/rngs/mock.rs @@ -10,7 +10,7 @@ #![allow(deprecated)] -use rand_core::{impls, RngCore}; +use rand_core::{RngCore, impls}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/src/rngs/mod.rs b/src/rngs/mod.rs index c60ae352ea3..e4adba47bc4 100644 --- a/src/rngs/mod.rs +++ b/src/rngs/mod.rs @@ -96,7 +96,7 @@ pub use reseeding::ReseedingRng; #[deprecated(since = "0.9.2")] pub mod mock; // Public so we don't export `StepRng` directly, making it a bit - // more clear it is intended for testing. +// more clear it is intended for testing. #[cfg(feature = "small_rng")] mod small; diff --git a/src/rngs/reseeding.rs b/src/rngs/reseeding.rs index 69b9045e0de..df561991a7e 100644 --- a/src/rngs/reseeding.rs +++ b/src/rngs/reseeding.rs @@ -253,9 +253,9 @@ where #[cfg(feature = "std_rng")] #[cfg(test)] mod test { + use crate::Rng; use crate::rngs::std::Core; use crate::test::const_rng; - use crate::Rng; use super::ReseedingRng; diff --git a/src/seq/index.rs b/src/seq/index.rs index 7dd0513850c..77f2ec2f58a 100644 --- a/src/seq/index.rs +++ b/src/seq/index.rs @@ -13,9 +13,9 @@ use core::{hash::Hash, ops::AddAssign}; // BTreeMap is not as fast in tests, but better than nothing. #[cfg(feature = "std")] use super::WeightError; +use crate::Rng; use crate::distr::uniform::SampleUniform; use crate::distr::{Distribution, Uniform}; -use crate::Rng; #[cfg(not(feature = "std"))] use alloc::collections::BTreeSet; #[cfg(feature = "serde")] diff --git a/src/seq/iterator.rs b/src/seq/iterator.rs index c50d4a58103..99d1b81bc12 100644 --- a/src/seq/iterator.rs +++ b/src/seq/iterator.rs @@ -8,9 +8,9 @@ //! `IteratorRandom` -use super::coin_flipper::CoinFlipper; #[allow(unused)] use super::IndexedRandom; +use super::coin_flipper::CoinFlipper; use crate::Rng; #[cfg(feature = "alloc")] use alloc::vec::Vec; @@ -550,9 +550,11 @@ mod test { // no randomization happens when amount >= len assert_eq!(large_sample, vals.iter().collect::>()); - assert!(small_sample - .iter() - .all(|e| { **e >= min_val && **e <= max_val })); + assert!( + small_sample + .iter() + .all(|e| { **e >= min_val && **e <= max_val }) + ); } #[test] diff --git a/src/seq/slice.rs b/src/seq/slice.rs index 67615f100b6..7943caae2f7 100644 --- a/src/seq/slice.rs +++ b/src/seq/slice.rs @@ -10,11 +10,11 @@ use super::increasing_uniform::IncreasingUniform; use super::index; +use crate::Rng; #[cfg(feature = "alloc")] use crate::distr::uniform::{SampleBorrow, SampleUniform}; #[cfg(feature = "alloc")] use crate::distr::weighted::{Error as WeightError, Weight}; -use crate::Rng; use core::ops::{Index, IndexMut}; /// Extension trait on indexable lists, providing random sampling methods. @@ -170,7 +170,7 @@ pub trait IndexedRandom: Index { B: SampleBorrow, X: SampleUniform + Weight + PartialOrd, { - use crate::distr::{weighted::WeightedIndex, Distribution}; + use crate::distr::{Distribution, weighted::WeightedIndex}; let distr = WeightedIndex::new((0..self.len()).map(|idx| weight(&self[idx])))?; Ok(&self[distr.sample(rng)]) } @@ -288,7 +288,7 @@ pub trait IndexedMutRandom: IndexedRandom + IndexMut { B: SampleBorrow, X: SampleUniform + Weight + PartialOrd, { - use crate::distr::{weighted::WeightedIndex, Distribution}; + use crate::distr::{Distribution, weighted::WeightedIndex}; let distr = WeightedIndex::new((0..self.len()).map(|idx| weight(&self[idx])))?; let index = distr.sample(rng); Ok(&mut self[index])