-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rand 0.5.1 no longer compile for wasm32-unknown-unknown #503
Comments
After comparing with the version 0.5.0, it seems this has been rewoved: #[cfg(all(target_arch = "wasm32",
not(target_os = "emscripten"),
not(feature = "stdweb")))]
mod imp {
use {Error, ErrorKind};
#[derive(Clone, Debug)]
pub struct OsRng;
impl OsRng {
pub fn new() -> Result<OsRng, Error> {
Err(Error::new(ErrorKind::Unavailable,
"not supported on WASM without stdweb"))
}
pub fn try_fill_bytes(&mut self, _v: &mut [u8]) -> Result<(), Error> {
Err(Error::new(ErrorKind::Unavailable,
"not supported on WASM without stdweb"))
}
}
} Removing this was a breaking change for |
There seems to come no end to the trouble We have two options:
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 But technically that is a breaking change. Maybe we should just to the sub-optimal fix in the 0.5 branch, and make |
So @sebcrozet you were using WASM without We could configure out |
For
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). |
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.:
|
Great, thanks @dhardy ! I confirm the 0.5 branch compiles for Edit: thanks to @pitdicker as well for making the PR! |
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 ifstdweb
is not selected. Instead, the part ofrand
that require stdweb should be deactivated by conditional compilation when we target wasm32-unknown-unknown without activating thestdweb
feature.The text was updated successfully, but these errors were encountered: