From 3a02922dc1036aa06f245d30cbd7d61e9d89e3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 21 Mar 2025 20:00:15 +0300 Subject: [PATCH] Add warnings for `wasm_js` --- Cargo.toml | 2 ++ README.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 41b7a676d..19c8ee526 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,8 @@ rustc-dep-of-std = ["dep:compiler_builtins", "dep:core"] # Optional backend: wasm_js # This flag enables the backend but does not select it. To use the backend, use # this flag *and* set getrandom_backend=wasm_js (see README). +# WARNING: It is highly recommended to enable this feature only for binary crates and tests, +# i.e. avoid unconditionally enabling it in library crates. wasm_js = ["dep:wasm-bindgen", "dep:js-sys"] [dependencies] diff --git a/README.md b/README.md index a0407d978..858247e64 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,9 @@ Crypto methods [described above][opt-in] via [`wasm-bindgen`], do This backend supports both web browsers (main window and Web Workers) and Node.js (v19 or later) environments. +WARNING: It is highly recommended to enable the `wasm_js` feature only for +binary crates and tests, i.e. avoid unconditionally enabling it in library crates. + ### Custom backend If this crate does not support your target out of the box or you have to use