Skip to content

Add support for wasm32-wasip1 and wasm32-wasip2, remove support for wasm32-wasi#499

Merged
newpavlov merged 8 commits intomasterfrom
wasip2
Sep 27, 2024
Merged

Add support for wasm32-wasip1 and wasm32-wasip2, remove support for wasm32-wasi#499
newpavlov merged 8 commits intomasterfrom
wasip2

Conversation

@newpavlov
Copy link
Copy Markdown
Member

The wasm32-wasi target will be removed in Rust 1.84 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.

Closes #492

@newpavlov newpavlov requested a review from josephlr September 5, 2024 12:02
@newpavlov newpavlov added this to the Next Release milestone 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();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WASI 0.2 target should already be available on the beta channel, and will be available on stable come Rust 1.82.

@newpavlov newpavlov merged commit 6c6fbef into master Sep 27, 2024
@newpavlov newpavlov deleted the wasip2 branch September 27, 2024 16:31
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider updating to wasi v0.13.1+wasi-0.2.0

2 participants