Skip to content

feat(deps): update rand#306

Closed
CosminPerRam wants to merge 6 commits intoramosbugs:mainfrom
CosminPerRam:feat/update_rands
Closed

feat(deps): update rand#306
CosminPerRam wants to merge 6 commits intoramosbugs:mainfrom
CosminPerRam:feat/update_rands

Conversation

@CosminPerRam
Copy link
Contributor

@CosminPerRam CosminPerRam commented Mar 13, 2025

EDIT: This PR originally went to update getrandom too, but that includes a wasm breaking change and can be done in a major version only.

Updates rand from 0.8 to 0.9 and getrandom from 0.2 to 0.3.

The rand update included some deprecations, I've replaced them.
The getrandom update renamed the js feature to wasm_js.

I'd like this to be merged as I currently use other crates that are on the newer versions (and this one adds duplicated deps).

@CosminPerRam
Copy link
Contributor Author

Hopefully I've correctly updated Cargo-1.65.lock, if not, please mention to revert.

@CosminPerRam
Copy link
Contributor Author

@ramosbugs bump, any blockers for this to be merged?

@ramosbugs
Copy link
Owner

does this require every WASM build to set rustflags = ['--cfg', 'getrandom_backend="wasm_js"']? if so, I think this is a breaking change that will have to wait for the next major release

@CosminPerRam
Copy link
Contributor Author

Unfortunately yes, I'll remove the getrandom dependency update from this PR for now.

@CosminPerRam CosminPerRam changed the title feat(deps): update rand and getrandom feat(deps): update rand Apr 27, 2025
@CosminPerRam
Copy link
Contributor Author

Apparently neither can rand be updated to 0.9 as it depends on rand_core 0.9 which itself depends on getrandom 0.3, which requires the flags, closing this for now.

@bim9262
Copy link

bim9262 commented Jan 6, 2026

Does adding the following to Cargo.toml resolve the issue?

[target.wasm32-unknown-unknown]
# The dependency getrandom needs this flag set, but only when the target is wasm32-unknown-unknown.
# https://docs.rs/getrandom/latest/getrandom/#opt-in-backends
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']

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