Conversation
windows-legacy opt-in backendwindows_legacy opt-in backend
josephlr
reviewed
Sep 29, 2025
| match rustc_minor_version() { | ||
| Some(minor_ver) if minor_ver < WIN7_INTRODUCED_MINOR_VER => { | ||
| println!("cargo:rustc-cfg=getrandom_windows_legacy"); | ||
| println!("cargo:rustc-cfg=getrandom_backend=\"windows_legacy\""); |
Member
There was a problem hiding this comment.
One thing that concerned me about this line is if it would override users who used --getrandom_backend="whatever" on Windows when using an older compiler.
Turns out, I can be an issue, but depends on the value of "whatever". Opened #728 to fix.
Member
|
Other than #728, this looks good. Thanks for taking care of this. It makes things a lot clearer to the user. |
Merged
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 <joerichey@google.com>
takumi-earth
pushed a commit
to earthlings-dev/getrandom
that referenced
this pull request
Jan 27, 2026
Some users may prefer to use the legacy Windows backend (e.g. see rust-random#723), so I think it's worth to introduce a documented configuration flag for it and replace the undocumented `getrandom_windows_legacy` flag.
takumi-earth
pushed a commit
to earthlings-dev/getrandom
that referenced
this pull request
Jan 27, 2026
## [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 [rust-random#671], [rust-random#675], and [rust-random#730]. ### Added - `unsupported` opt-in backend [rust-random#667] - `windows_legacy` opt-in backend [rust-random#724] ### Changed - Implement Memory Sanitizer unpoisoning more precisely [rust-random#678] - Relax MSRV for the `linux_raw` opt-in backend on ARM targets [rust-random#688] - Use `getrandom` syscall on all RISC-V Linux targets [rust-random#699] - Replaced `wasi` dependency with `wasip2` [rust-random#721] - Enable `wasm_js` backend by default if the `wasm_js` feature is enabled [rust-random#730] ### Removed - Unstable `rustc-dep-of-std` crate feature [rust-random#694] [rust-random#667]: rust-random#667 [rust-random#671]: rust-random#671 [rust-random#675]: rust-random#675 [rust-random#678]: rust-random#678 [rust-random#688]: rust-random#688 [rust-random#694]: rust-random#694 [rust-random#699]: rust-random#699 [rust-random#721]: rust-random#721 [rust-random#724]: rust-random#724 [rust-random#730]: rust-random#730 --------- Signed-off-by: Joe Richey <joerichey@google.com>
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.
Some users may prefer to use the legacy Windows backend (e.g. see #723), so I think it's worth to introduce a documented configuration flag for it and replace the undocumented
getrandom_windows_legacyflag.