Skip to content

Fix wasm_js feature combined with a backend override on Wasm - #875

Open
ryanhossain9797 wants to merge 3 commits into
rust-random:masterfrom
ryanhossain9797:fix-wasm-js-backend-override
Open

ryanhossain9797 wants to merge 3 commits into
rust-random:masterfrom
ryanhossain9797:fix-wasm-js-backend-override

Conversation

@ryanhossain9797

Copy link
Copy Markdown

Error::WEB_CRYPTO is only defined when the wasm_js backend is actually selected, but its description in Error::internal_desc was gated on the wasm_js feature alone. Enabling the feature together with getrandom_backend="unsupported", "custom" or "extern_impl" on wasm32-unknown-unknown therefore failed to compile.

Exclude those overrides from the cfg and extend the CI job to build the unsupported and custom overrides with and without wasm_js.

`Error::WEB_CRYPTO` is only defined when the `wasm_js` backend is
actually selected, but its description in `Error::internal_desc` was
gated on the `wasm_js` feature alone. Enabling the feature together with
`getrandom_backend="unsupported"`, `"custom"` or `"extern_impl"` on
`wasm32-unknown-unknown` therefore failed to compile.

Exclude those overrides from the cfg and extend the CI job to build the
`unsupported` and `custom` overrides with and without `wasm_js`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@josephlr josephlr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch! And the CI fix also looks good.

@josephlr josephlr mentioned this pull request Nov 4, 2026
@ryanhossain9797

Copy link
Copy Markdown
Author

Good catch! And the CI fix also looks good.

Thanks!

What's the merge process? Do you guys handle it?

@josephlr

josephlr commented Nov 6, 2026

Copy link
Copy Markdown
Member

Good catch! And the CI fix also looks good.

Thanks!

What's the merge process? Do you guys handle it?

#872 will track the next release (and if/how we include this PR).

@newpavlov

Copy link
Copy Markdown
Member

Hm, I wonder if we have a similar issue with IOS_RANDOM_GEN, WINDOWS_RTL_GEN_RANDOM, and VXWORKS_RAND_SECURE. It may be worth to move custom error definitions to the error module instead of gating it like this.

@newpavlov

Copy link
Copy Markdown
Member

I opened #876 as a potential alternative to this.

newpavlov added a commit that referenced this pull request Nov 6, 2026

This branch has not been deployed

No deployments
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