From 94a5771c299f65a422815c0efbf045dd3fd00523 Mon Sep 17 00:00:00 2001 From: Protryon Date: Mon, 29 Jul 2024 10:46:46 -0700 Subject: [PATCH] split out wasm32_unknown_unknown_js feature --- Cargo.toml | 3 ++- src/lib.rs | 4 ++++ src/rand.rs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8c6cfd8a45..86bf181b25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -195,7 +195,8 @@ std = ["alloc"] unstable-testing-arm-no-hw = [] unstable-testing-arm-no-neon = [] test_logging = [] -wasm32_unknown_unknown_js = ["getrandom/js"] +wasm32_unknown_unknown_js = ["getrandom/js", "wasm32_unknown_unknown"] +wasm32_unknown_unknown = [] # XXX: debug = false because of https://github.com/rust-lang/rust/issues/34122 diff --git a/src/lib.rs b/src/lib.rs index 830b0898ce..3d07294311 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,6 +49,10 @@ //! require an operating environment of some kind. This has no effect //! for any other target. This enables the `getrandom` crate's `js` //! feature. +//! wasm32_unknown_unknown +//! When this feature is enabled, for the wasm32-unknown-unknown target, +//! `getrandom` is used and assumed to be preconfigured in a WASM +//! environment. This has no effect for any other target. //! // When running mk/package.sh, don't actually build any code. diff --git a/src/rand.rs b/src/rand.rs index 71ba60288b..5807db8a59 100644 --- a/src/rand.rs +++ b/src/rand.rs @@ -153,7 +153,7 @@ impl crate::sealed::Sealed for SystemRandom {} target_arch = "wasm32", any( target_os = "wasi", - all(target_os = "unknown", feature = "wasm32_unknown_unknown_js") + all(target_os = "unknown", feature = "wasm32_unknown_unknown") ) ), ))]