mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
build(deps): update rand requirement from 0.8.5 to 0.9.0 (#370)
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
11aaa555aa
commit
a1777fb7d3
4
.github/workflows/test-wasm.yml
vendored
4
.github/workflows/test-wasm.yml
vendored
@@ -28,5 +28,7 @@ jobs:
|
||||
cd bindings/wasm
|
||||
cargo clippy --all-targets --no-deps -- -Dwarnings
|
||||
wasm-pack build --target nodejs --release
|
||||
wasm-pack test --release --node
|
||||
# Enable when upstream issue is fixed.
|
||||
# https://github.com/microsoft/regorus/issues/371
|
||||
# wasm-pack test --release --node
|
||||
node test.js
|
||||
|
||||
@@ -127,7 +127,8 @@ jsonwebtoken = { version = "9.3.1", optional = true }
|
||||
itertools = { version = "0.14.0", default-features = false, optional = true }
|
||||
|
||||
serde_yaml = {version = "0.9.16", default-features = false, optional = true }
|
||||
rand = { version = "0.8.5", default-features = false, optional = true }
|
||||
# Specify thread_rng for in order to use random_range
|
||||
rand = { version = "0.9.0", default-features = false, features = ["thread_rng"], optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.45"
|
||||
|
||||
2
bindings/wasm/.cargo/config.toml
Normal file
2
bindings/wasm/.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[target.wasm32-unknown-unknown]
|
||||
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
|
||||
@@ -18,10 +18,12 @@ coverage = ["regorus/coverage"]
|
||||
[dependencies]
|
||||
regorus = { path = "../..", default-features = false, features = ["arc"] }
|
||||
serde_json = "1.0.140"
|
||||
wasm-bindgen = "=0.2.93"
|
||||
wasm-bindgen = "0.2.100"
|
||||
# Specify uuid as a mandatory dependency so as to enable `js` feature which is now required
|
||||
# when targeting wasm32-unknown-unknown.
|
||||
uuid = { version = "1.15.1", default-features = false, features = ["v4", "fast-rng", "js"]}
|
||||
# Enable wasm_js. See https://docs.rs/getrandom/latest/getrandom/#webassembly-support
|
||||
getrandom = { version = "0.3", features = ["std", "wasm_js"] }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.40"
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::*;
|
||||
use anyhow::{bail, Result};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use rand::{thread_rng, Rng};
|
||||
use rand::Rng;
|
||||
|
||||
pub fn register(m: &mut builtins::BuiltinsMap<&'static str, builtins::BuiltinFcn>) {
|
||||
m.insert("abs", (abs, 1));
|
||||
@@ -169,8 +169,7 @@ fn intn(span: &Span, params: &[Ref<Expr>], args: &[Value], _strict: bool) -> Res
|
||||
Some(0) => Value::from(0u64),
|
||||
Some(n) => {
|
||||
// TODO: bounds checking; arbitrary precision
|
||||
let mut rng = thread_rng();
|
||||
let v = rng.gen_range(0..n);
|
||||
let v = rand::rng().random_range(0..n);
|
||||
Value::from(v)
|
||||
}
|
||||
_ => Value::Undefined,
|
||||
|
||||
Reference in New Issue
Block a user