Skip to content

Commit 2d033b7

Browse files
authored
Release Version v0.3.4 (#735)
## [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]>
1 parent ccb0ca9 commit 2d033b7

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

CHANGELOG.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,24 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.3.4] - UNRELEASED
7+
## [0.3.4] - 2025-10-14
8+
9+
### Major change to `wasm_js` backend
10+
11+
Now, when the `wasm_js` feature is enabled, the `wasm_js` backend will be used
12+
by default. Users of `wasm32-unknown-unknown` targeting JavaScript environments
13+
like the Web and Node.js will no longer need to specify:
14+
```
15+
--cfg getrandom_backend="wasm_js"
16+
```
17+
in `RUSTFLAGS` for the crate to compile. They can now simple enable a feature.
18+
19+
Note: this should not affect non-JS users of the `wasm32-unknown-unknown`
20+
target. Using `--cfg getrandom_backend` will still override the source of
21+
randomness _even if_ the `wasm_js` feature is enabled. This includes
22+
`--cfg getrandom_backend=custom` and `--cfg getrandom_backend=unsupported`.
23+
24+
For more information, see the discussions in [#671], [#675], and [#730].
825

926
### Added
1027
- `unsupported` opt-in backend [#667]
@@ -15,25 +32,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1532
- Relax MSRV for the `linux_raw` opt-in backend on ARM targets [#688]
1633
- Use `getrandom` syscall on all RISC-V Linux targets [#699]
1734
- Replaced `wasi` dependency with `wasip2` [#721]
35+
- Enable `wasm_js` backend by default if the `wasm_js` feature is enabled [#730]
1836

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

2240
[#667]: https://github.com/rust-random/getrandom/pull/667
41+
[#671]: https://github.com/rust-random/getrandom/issues/671
42+
[#675]: https://github.com/rust-random/getrandom/pull/675
2343
[#678]: https://github.com/rust-random/getrandom/pull/678
2444
[#688]: https://github.com/rust-random/getrandom/pull/688
2545
[#694]: https://github.com/rust-random/getrandom/pull/694
2646
[#699]: https://github.com/rust-random/getrandom/pull/699
2747
[#721]: https://github.com/rust-random/getrandom/pull/721
2848
[#724]: https://github.com/rust-random/getrandom/pull/724
49+
[#730]: https://github.com/rust-random/getrandom/pull/730
2950

3051
## [0.3.3] - 2025-05-09
3152

3253
### Changed
3354
- Doc improvements [#632] [#634] [#635]
3455
- Add crate version to docs.rs links used in `compile_error!`s [#639]
3556

36-
## Fixed
57+
### Fixed
3758
- Error handling in WASI p1 [#661]
3859

3960
[#632]: https://github.com/rust-random/getrandom/pull/632

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ of randomness based on their specific needs:
8484
| `linux_raw` | Linux, Android | `*‑linux‑*` | Same as `linux_getrandom`, but uses raw `asm!`-based syscalls instead of `libc`.
8585
| `rdrand` | x86, x86-64 | `x86_64-*`, `i686-*` | [`RDRAND`] instruction
8686
| `rndr` | AArch64 | `aarch64-*` | [`RNDR`] register
87-
| `wasm_js` | Web Browser, Node.js | `wasm32‑unknown‑unknown`, `wasm32v1-none` | [`Crypto.getRandomValues`]. Requires feature `wasm_js` ([see below](#webassembly-support)).
87+
| `wasm_js` | Web Browser, Node.js | `wasm32‑unknown‑unknown`, `wasm32v1-none` | [`Crypto.getRandomValues`]. Enabled by the `wasm_js` feature ([see below](#webassembly-support)).
8888
| `efi_rng` | UEFI | `*-unknown‑uefi` | [`EFI_RNG_PROTOCOL`] with `EFI_RNG_ALGORITHM_RAW` (requires `std` and Nightly compiler)
8989
| `windows_legacy` | Windows | `*-windows-*` | [`RtlGenRandom`]
9090
| `custom` | All targets | `*` | User-provided custom implementation (see [custom backend])
@@ -138,8 +138,9 @@ requires [`wasm-bindgen`], **bloating `Cargo.lock`** and
138138

139139
To enable `getrandom`'s functionality on `wasm32-unknown-unknown` using the Web
140140
Crypto methods [described above][opt-in] via [`wasm-bindgen`], enable the
141-
`wasm_js` feature flag. Optionally, one can also set
142-
`RUSTFLAGS='--cfg getrandom_backend="wasm_js"'`.
141+
`wasm_js` feature flag. Setting `RUSTFLAGS='--cfg getrandom_backend="wasm_js"'`
142+
is allowed but is no longer required and does nothing (it was required in a
143+
prior version of this crate).
143144

144145
WARNING: enabling the `wasm_js` feature will bloat `Cargo.lock` on all platforms
145146
(where [`wasm-bindgen`] is not an existing dependency) and is known to cause

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ fn main() {
3434
// Automatically detect cfg(sanitize = "memory") even if cfg(sanitize) isn't
3535
// supported. Build scripts get cfg() info, even if the cfg is unstable.
3636
println!("cargo:rerun-if-changed=build.rs");
37-
let santizers = std::env::var("CARGO_CFG_SANITIZE").unwrap_or_default();
38-
if santizers.contains("memory") {
37+
let sanitizers = std::env::var("CARGO_CFG_SANITIZE").unwrap_or_default();
38+
if sanitizers.contains("memory") {
3939
println!("cargo:rustc-cfg=getrandom_msan");
4040
}
4141

0 commit comments

Comments
 (0)