From b52634405bc99c678d54b1b3665f299fd6e84677 Mon Sep 17 00:00:00 2001 From: Adia Robbie Date: Mon, 24 Oct 2022 03:31:44 +0700 Subject: [PATCH] Fix compiler error on wasm with deault features. (#129) * Fix compiler error on wasm. --- .github/workflows/rust.yml | 2 +- Cargo.toml | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e2c51ca..ba596bf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -148,4 +148,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: check - args: --target wasm32-unknown-unknown --no-default-features + args: --target wasm32-unknown-unknown diff --git a/Cargo.toml b/Cargo.toml index 6a0093a..c7acc03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,11 +68,18 @@ codegen-units = 1 version_check = "0.9.4" [dependencies] -getrandom = { version = "0.2.3", optional = true } const-random = { version = "0.1.12", optional = true } serde = { version = "1.0.117", optional = true } cfg-if = "1.0" +[target."cfg(not(any(target_arch = \"wasm32\", target_abi = \"unknown\")))".dependencies.getrandom] +version = "0.2.7" +optional = true + +[target."cfg(any(target_arch = \"wasm32\", target_abi = \"unknown\"))".dependencies.getrandom] +version = "0.2.7" +features = ["js"] + [target.'cfg(not(all(target_arch = "arm", target_os = "none")))'.dependencies] once_cell = { version = "1.8", default-features = false, features = ["unstable", "alloc"] }