File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 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") ;
You can’t perform that action at this time.
0 commit comments