You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just released 0.1.10 of getrandom to fix this kind of issue (rust-random/getrandom#87), now it will always build on wasm32-unknown-unknown and will fail at runtime if there's no way to call JavaScript.
Running cargo test --target=wasm32-unknown-unknown now properly builds the output. Note that if we ever want to have any wasm32-unknown-unknown tests in this repo that use randomness, we should enable the wasm-bindgen feature of getrandom.
I‘m not sure if I fully understand how this was fixed.
Do we depend on getrandom directly? I thought we depend on rand only.
That is, getrandom not building is more like a symptom of rand trying to
use it on a platform that doesn’t support it.
So the questions I have are:
- Why does rand depend on getrandom for wasm32-unknown-unknown at all?
- Is rand tested on this platform? (That would have caught this issue)
Whether getrandom fails to build or not for the target is probably up to
the getrandom maintainers, but either way, even if it builds correctly, it
is probably going to lack functionality, so randaybe shouldn’t even try to
use it for this target.
cc @alexcrichton @josephlr
The text was updated successfully, but these errors were encountered: