- 
                Notifications
    You must be signed in to change notification settings 
- Fork 237
Description
Currently getrandom works on WASM only in a JS environment. If you try to compile a crate which depends on getrandom on wasm32-unknown-unknown and without the js feature, it fails and cannot be made to compile.
For context, in the Internet Computer (https://github.com/dfinity/ic) applications are deployed as WASM and without WASI or a JS environment (because the applications are sandboxed and completely deterministic). I am running into exactly this situation, where upgrading a dependency of ours brings in getrandom 0.2, and as a result the build fails :( Setting "js" feature doesn't help because there is no JS or WASI.
Would you consider (for wasm32-unknown-unknown only) an additional feature "unimplemented" analogous to the "js" feature, but which just has getrandom return Err(UNSUPPORTED) in all cases. I would be happy to contribute a patch along these lines if it would be accepted.
I know this can be emulated using https://docs.rs/getrandom/0.2.3/getrandom/macro.register_custom_getrandom.html but the downside there is it requires each bin crate to set the getrandom handler specially. In our case the getrandom dependency arises deep in the dep tree and we do not actually need getrandom to work at all, so pushing this task onto each and every person who would choose to write an application to run on the IC is a non-starter. In contrast if we can set the feature within our own crates then everything should just work.