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
{{ message }}
Repository navigation
rand 0.5.1 no longer compile for wasm32-unknown-unknown #503
It appears the release 0.5.1 breaks compilation for the wasm32-unknown-unknown target.
I understand that activating the stdweb feature fixes the compilation error, but it seems wrong to just fail to compile if stdweb is not selected. Instead, the part of rand that require stdweb should be deactivated by conditional compilation when we target wasm32-unknown-unknown without activating the stdweb feature.
There seems to come no end to the trouble wams-unknown-unknown causes us 🙁. Thank you for reporting!
We have two options:
add back the "not supported" stub (and in this case for all unsupported platforms)
configure out OsRng on unsupported platforms.
I think the second option is the best choice, as it moves the error from runtime to compile-time. (The error will only occur when someone uses OsRng on an unsupported platform, not always as is the bug this issue is about.) The solution for crates is to work everywhere is to use EntropyRng instead of OsRng.
But technically that is a breaking change. Maybe we should just to the sub-optimal fix in the 0.5 branch, and make OsRng unavailable in 0.6.
So @sebcrozet you were using WASM without stdweb or emscripten? I was sceptical from the start about failing with a run-time error when the required features were unavailable, but was told this was the way std were doing it.
We could configure out OsRng as mentioned, but this will also remove thread_rng, EntropyRng and FromEntropy.
For quicksilver they apparently didn't realise the stdweb feature can be used.
but it seems wrong to just fail to compile if stdweb is not selected. Instead, the part of rand that require stdweb should be deactivated by conditional compilation when we target wasm32-unknown-unknown without activating the stdweb feature
I agree, this should be the preferred solution. Assuming no objections, I think we should just implement this for 0.5.2 (even though it's technically a breaking change from 0.5.0).
Activity
sebcrozet commentedon Jun 9, 2018
After comparing with the version 0.5.0, it seems this has been rewoved:
Removing this was a breaking change for
randsince this broke compilation of downstream crate that don't activate thestdwebfeature.pitdicker commentedon Jun 9, 2018
There seems to come no end to the trouble
wams-unknown-unknowncauses us 🙁. Thank you for reporting!We have two options:
OsRngon unsupported platforms.I think the second option is the best choice, as it moves the error from runtime to compile-time. (The error will only occur when someone uses
OsRngon an unsupported platform, not always as is the bug this issue is about.) The solution for crates is to work everywhere is to useEntropyRnginstead ofOsRng.But technically that is a breaking change. Maybe we should just to the sub-optimal fix in the 0.5 branch, and make
OsRngunavailable in 0.6.dhardy commentedon Jun 9, 2018
So @sebcrozet you were using WASM without
stdweboremscripten? I was sceptical from the start about failing with a run-time error when the required features were unavailable, but was told this was the waystdwere doing it.We could configure out
OsRngas mentioned, but this will also removethread_rng,EntropyRngandFromEntropy.dhardy commentedon Jun 13, 2018
For
quicksilverthey apparently didn't realise thestdwebfeature can be used.I agree, this should be the preferred solution. Assuming no objections, I think we should just implement this for 0.5.2 (even though it's technically a breaking change from 0.5.0).
dhardy commentedon Jun 16, 2018
Fixed by #512 (and #514). Will be released in 0.5.2 soon.
Is someone (@sebcrozet?) able to test using the 0.5 branch? I.e.:
sebcrozet commentedon Jun 16, 2018
Great, thanks @dhardy ! I confirm the 0.5 branch compiles for
wasm32-unknown-unknownwithout thestdwebfeature.Edit: thanks to @pitdicker as well for making the PR!