Skip to content

Commit 0eb0be1

Browse files
authored
Update docs and compile_errors for wasm32-unknown-unknown (#209)
Signed-off-by: Joe Richey <[email protected]>
1 parent c4a0004 commit 0eb0be1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
//! This crate fully supports the
6060
//! [`wasm32-wasi`](https://github.com/CraneStation/wasi) and
6161
//! [`wasm32-unknown-emscripten`](https://www.hellorust.com/setup/emscripten/)
62-
//! targets. However, the `wasm32-unknown-unknown` target is not automatically
62+
//! targets. However, the `wasm32-unknown-unknown` target (i.e. the target used
63+
//! by `wasm-pack`) is not automatically
6364
//! supported since, from the target name alone, we cannot deduce which
6465
//! JavaScript interface is in use (or if JavaScript is available at all).
6566
//!
@@ -209,6 +210,11 @@ cfg_if! {
209210
#[path = "js.rs"] mod imp;
210211
} else if #[cfg(feature = "custom")] {
211212
use custom as imp;
213+
} else if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] {
214+
compile_error!("the wasm32-unknown-unknown target is not supported by \
215+
default, you may need to enable the \"js\" feature. \
216+
For more information see: \
217+
https://docs.rs/getrandom/#webassembly-support");
212218
} else {
213219
compile_error!("target is not supported, for more information see: \
214220
https://docs.rs/getrandom/#unsupported-targets");

0 commit comments

Comments
 (0)