-
Notifications
You must be signed in to change notification settings - Fork 217
Description
As noted in #346, we could support wasm32-unknown-unknown
on web when the js
feature is enabled. The major problem is was (see next comment) what to do when the custom
backend is also enabled:
Defaulting to theNo longer true: the user must the thecustom
backend is not okay: any crate in the dependency tree could overwrite the (secure) random source used by a binary.getrandom_backend
cfg.- Defaulting to the
js
backend isnotokay: many crates depend ongetrandom
with thejs
feature for convenience,which would prevent support for a custom backend(no longer true; see next comment).
Updated suggestion in next comment.
Original suggestion
We could instead consider this a compiler error. This deviates significantly from standard usage of features which should be additive (i.e. any combination including all of them is valid).
Nevertheless, this might be workable. Any crate which could possibly be used on a non-web wasm32-unknown-unknown
platform depending on getrandom
with feature js
would be a bug, forcing these crates not to do so (or to explicitly not support non-web wasm32-u-u targets).
This is (I believe) the simplest solution for wasm32-u-u which doesn't block getrandom
from supporting non-web targets.