Skip to content

Conversation

dhardy
Copy link
Member

@dhardy dhardy commented Sep 29, 2025

Implements #675. Closes #726.

Should we remove support for getrandom_backend="wasm_js" since it is redundant? That would be a breaking change, and I'm not 100% sure it would never be wanted (though the wasm_js module currently throws an error of target_os is not either "unknown" or "none").

@dhardy dhardy changed the title Implement #675 Implement #675: let wasm_js enable the backend by default Sep 29, 2025
@dhardy
Copy link
Member Author

dhardy commented Oct 10, 2025

Pinging @newpavlov @josephlr for feedback please.

@newpavlov
Copy link
Member

I will leave it to @josephlr to accept, merge, and release this PR. Implementation-wise, I don't see any issues.

Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for putting this together and sorry for the delay. I'll merge this now, and writeup the changelog and release notes tomorrow.

@josephlr
Copy link
Member

Should we remove support for getrandom_backend="wasm_js" since it is redundant? That would be a breaking change, and I'm not 100% sure it would never be wanted (though the wasm_js module currently throws an error of target_os is not either "unknown" or "none").

I think we should keep it for now, both to avoid a breaking change, and to give people a better error message when they try to select the backend without enabling the required feature.

@josephlr josephlr merged commit 1af2510 into master Oct 13, 2025
75 checks passed
@josephlr josephlr deleted the push-rrusrnpzszvs branch October 13, 2025 09:06
@josephlr josephlr mentioned this pull request Oct 14, 2025
josephlr added a commit that referenced this pull request Oct 14, 2025
## [0.3.4] - 2025-10-14

### Major change to `wasm_js` backend

Now, when the `wasm_js` feature is enabled, the `wasm_js` backend will
be used
by default. Users of `wasm32-unknown-unknown` targeting JavaScript
environments
like the Web and Node.js will no longer need to specify:
```
--cfg getrandom_backend="wasm_js"
```
in `RUSTFLAGS` for the crate to compile. They can now simple enable a
feature.

Note: this should not affect non-JS users of the
`wasm32-unknown-unknown`
target. Using `--cfg getrandom_backend` will still override the source
of
randomness _even if_ the `wasm_js` feature is enabled. This includes
`--cfg getrandom_backend=custom` and `--cfg
getrandom_backend=unsupported`.

For more information, see the discussions in [#671], [#675], and [#730].

### Added
- `unsupported` opt-in backend [#667]
- `windows_legacy` opt-in backend [#724]

### Changed
- Implement Memory Sanitizer unpoisoning more precisely [#678]
- Relax MSRV for the `linux_raw` opt-in backend on ARM targets [#688]
- Use `getrandom` syscall on all RISC-V Linux targets [#699]
- Replaced `wasi` dependency with `wasip2` [#721]
- Enable `wasm_js` backend by default if the `wasm_js` feature is
enabled [#730]

### Removed
- Unstable `rustc-dep-of-std` crate feature [#694]

[#667]: #667
[#671]: #671
[#675]: #675
[#678]: #678
[#688]: #688
[#694]: #694
[#699]: #699
[#721]: #721
[#724]: #724
[#730]: #730

---------

Signed-off-by: Joe Richey <[email protected]>
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.

3 participants