Conversation
newpavlov
commented
Sep 5, 2024
| let mut chunks = dest.chunks_exact_mut(size_of::<u64>()); | ||
| for chunk in &mut chunks { | ||
| let dst: *mut u64 = chunk.as_mut_ptr().cast(); | ||
| let val = get_random_u64(); |
Member
Author
There was a problem hiding this comment.
get_random_u64 is used instead of get_random_bytes because the latter uses an allocation due to the Wit IDL restrictions. This should be fine since the main use case of getrandom is seed generation.
newpavlov
commented
Sep 5, 2024
…or `wasm32-wasi`
yoshuawuyts
approved these changes
Sep 6, 2024
yoshuawuyts
left a comment
There was a problem hiding this comment.
Hi there; WASI contributor here. I reviewed this and left some minor remarks about terminology - but overall this looks really good, and I'm excited for this to land!
.github/workflows/tests.yml
Outdated
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@nightly |
There was a problem hiding this comment.
The WASI 0.2 target should already be available on the beta channel, and will be available on stable come Rust 1.82.
Co-authored-by: Yosh <2467194+yoshuawuyts@users.noreply.github.com>
takumi-earth
pushed a commit
to earthlings-dev/getrandom
that referenced
this pull request
Jan 27, 2026
…or `wasm32-wasi` (rust-random#499) The `wasm32-wasi` target will be removed in Rust 1.84 (https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) and existing users are encouraged to migrate to either `wasm32-wasip1`, or `wasm32-wasip2`. Strictly speaking, this is a breaking change despite affecting only deprecated target, so it's probably better to release it in `getrandom` v0.3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
wasm32-wasitarget will be removed in Rust 1.84 and existing users are encouraged to migrate to eitherwasm32-wasip1, orwasm32-wasip2.Strictly speaking, this is a breaking change despite affecting only deprecated target, so it's probably better to release it in
getrandomv0.3.Closes #492