Skip to content

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Sep 19, 2025

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_legacy flag.

@newpavlov newpavlov requested a review from josephlr September 19, 2025 13:33
@newpavlov newpavlov changed the title Add windows-legacy opt-in backend Add windows_legacy opt-in backend Sep 19, 2025
@newpavlov newpavlov merged commit 3983e0f into master Sep 23, 2025
75 checks passed
@newpavlov newpavlov deleted the windows_legacy branch September 23, 2025 11:43
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\"");
Copy link
Member

Choose a reason for hiding this comment

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

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.

@josephlr
Copy link
Member

Other than #728, this looks good. Thanks for taking care of this. It makes things a lot clearer to the user.

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.

2 participants