diff --git a/Cargo.lock b/Cargo.lock index 244b4189d..d58c95622 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -687,7 +687,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20e5695565f0cd7106bc3c7170323597540e772bb73e0be2cd2c662a0f8fa4ca" dependencies = [ "ambient-authority", - "rand", + "rand 0.8.5", ] [[package]] @@ -1663,6 +1663,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + [[package]] name = "gimli" version = "0.28.1" @@ -1747,10 +1759,10 @@ name = "grit-pattern-matcher" version = "0.5.1" dependencies = [ "elsa", - "getrandom", + "getrandom 0.2.12", "grit-util", "itertools 0.10.5", - "rand", + "rand 0.9.4", "regex", ] @@ -2587,7 +2599,7 @@ dependencies = [ "anyhow", "embeddings", "fs-err", - "getrandom", + "getrandom 0.2.12", "grit-pattern-matcher", "grit-util", "insta", @@ -2601,7 +2613,7 @@ dependencies = [ "napi", "napi-derive", "path-absolutize", - "rand", + "rand 0.9.4", "rayon", "regex", "serde", @@ -2643,7 +2655,7 @@ dependencies = [ "marzano-core", "marzano-language", "marzano-util", - "rand", + "rand 0.9.4", "regex", "serde", "serde_yaml", @@ -3245,7 +3257,7 @@ dependencies = [ "opentelemetry", "ordered-float", "percent-encoding", - "rand", + "rand 0.8.5", "serde_json", "thiserror 1.0.63", "tokio", @@ -3575,8 +3587,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", - "getrandom", - "rand", + "getrandom 0.2.12", + "rand 0.8.5", "ring", "rustc-hash 2.1.1", "rustls 0.23.7", @@ -3610,6 +3622,12 @@ 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.8.5" @@ -3617,8 +3635,18 @@ 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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", ] [[package]] @@ -3628,7 +3656,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.5", ] [[package]] @@ -3637,7 +3675,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.12", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", ] [[package]] @@ -3675,7 +3722,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom", + "getrandom 0.2.12", "libredox", "thiserror 1.0.63", ] @@ -3829,7 +3876,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.12", "libc", "spin", "untrusted", @@ -4600,7 +4647,7 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand", + "rand 0.8.5", "slab", "tokio", "tokio-util", @@ -5068,7 +5115,7 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ - "getrandom", + "getrandom 0.2.12", "serde", "wasm-bindgen", ] @@ -5168,6 +5215,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -6078,6 +6134,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + [[package]] name = "wit-parser" version = "0.13.2" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 95be79bab..135f18510 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -34,7 +34,7 @@ serde = { version = "1.0.164", features = ["derive"] } sha2 = { version = "0.10.8" } rayon = { version = "1.8.0" } log = { version = "0.4.20" } -rand = { version = "0.8.5" } +rand = { version = "0.9.3" } path-absolutize = { version = "3.1.1", optional = false, features = [ "use_unix_paths_on_wasm", ] } diff --git a/crates/core/src/built_in_functions.rs b/crates/core/src/built_in_functions.rs index a8a4d3285..ffd534733 100644 --- a/crates/core/src/built_in_functions.rs +++ b/crates/core/src/built_in_functions.rs @@ -395,7 +395,7 @@ fn random_fn<'a>( let start = start.parse::().unwrap(); let end = end.parse::().unwrap(); // Inclusive range - let value = state.get_rng().gen_range(start..=end); + let value = state.get_rng().random_range(start..=end); Ok(ResolvedPattern::from_constant(Constant::Integer(value))) } [Some(_), None] => { @@ -405,7 +405,7 @@ fn random_fn<'a>( bail!("If you provide an end argument to random(), you must provide a start argument") } [None, None] => { - let value = state.get_rng().gen::(); + let value = state.get_rng().random::(); Ok(ResolvedPattern::from_constant(Constant::Float(value))) } _ => bail!("random() takes 0 or 2 arguments"), diff --git a/crates/grit-pattern-matcher/Cargo.toml b/crates/grit-pattern-matcher/Cargo.toml index ac13f5d6a..93b66d9a2 100644 --- a/crates/grit-pattern-matcher/Cargo.toml +++ b/crates/grit-pattern-matcher/Cargo.toml @@ -19,7 +19,7 @@ elsa = { version = "1.9.0" } getrandom = { version = "0.2.11", optional = true } grit-util = { path = "../grit-util", version = "0.5.1" } itertools = { version = "0.10.5" } -rand = { version = "0.8.5" } +rand = { version = "0.9.3" } regex = { version = "1.7.3" } [features] diff --git a/crates/grit-pattern-matcher/src/pattern/pattern_definition.rs b/crates/grit-pattern-matcher/src/pattern/pattern_definition.rs index 3da063e99..502aacb04 100644 --- a/crates/grit-pattern-matcher/src/pattern/pattern_definition.rs +++ b/crates/grit-pattern-matcher/src/pattern/pattern_definition.rs @@ -42,7 +42,7 @@ impl PatternDefinition { /// Create an unnamed ephemeral pattern /// This is primarily useful for the bubble pattern, where we want to create a new scope pub fn new_ephemeral(params: Vec<(String, Variable)>, pattern: Pattern) -> Self { - let random_name = format!("", rand::thread_rng().gen::()); + let random_name = format!("", rand::rng().random::()); Self { name: random_name, diff --git a/crates/gritmodule/Cargo.toml b/crates/gritmodule/Cargo.toml index 2d87e3f26..f395f7a81 100644 --- a/crates/gritmodule/Cargo.toml +++ b/crates/gritmodule/Cargo.toml @@ -22,7 +22,7 @@ serde = { version = "1.0.164", features = ["derive"] } serde_yaml = { version = "0.9.25" } anyhow = { version = "1.0.70" } futures = { version = "0.3.29" } -rand = { version = "0.8.5" } +rand = { version = "0.9.3" } git2 = { version = "0.19.0", default-features = false, features = [ "vendored-openssl", "vendored-libgit2",