Inspired by @dhardy's comment rust-lang/rust#62082 (comment)
This would simply remove the dummy implementation, causing a compiler error on unsupported platforms. This makes it much easier to detect platform support issues (as a compiler error is permeable to a run time error). This would also make it clear that when porting libstd or rand to a different platform, an implementation in getrandom is needed.
For example, @newpavlov's code in rust-lang/rust#62082 would be changed to:
letmut buf = [0u8;16];// Using a constant value is acceptable on whitelisted targets.#[cfg(not(target = "wasm32-unknown-unknown"))]ifletErr(err) = getrandom::getrandom(&mut buf){panic!("getrandom failure: {:?}", err)}let n = u128::from_ne_bytes(buf);Cell::new([n asu64,(n >> 64)asu64])Note that this would be a breaking change, so it would require 0.2
Inspired by @dhardy's comment rust-lang/rust#62082 (comment)
This would simply remove the dummy implementation, causing a compiler error on unsupported platforms. This makes it much easier to detect platform support issues (as a compiler error is permeable to a run time error). This would also make it clear that when porting
libstdorrandto a different platform, an implementation ingetrandomis needed.For example, @newpavlov's code in rust-lang/rust#62082 would be changed to:
Note that this would be a breaking change, so it would require
0.2