Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build for wasm32/64-unknown-unknown without std #395

Closed
wants to merge 2 commits into from

Conversation

gshep
Copy link

@gshep gshep commented Feb 13, 2024

fixes #394

  • specify default feature
  • use thread_local attribute for no_std wasm*-unknown-unknown
  • use core::mem::MaybeUninit
  • refactor getrandom_inner accordingly

@@ -30,6 +30,7 @@ js-sys = { version = "0.3", optional = true }
wasm-bindgen-test = "0.3.18"

[features]
default = ["std"]
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change.

RNG_SOURCE.with(|result| {
let source = result.as_ref().map_err(|&e| e)?;
#[cfg(not(std))]
#[thread_local]
Copy link
Member

Choose a reason for hiding this comment

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

#[thread_local] is unstable and even after stabilization will have a very high MSRV.

Copy link
Author

Choose a reason for hiding this comment

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

Yep, you're right however if I'm not mistaken this is the only alternative for no_std envs

@newpavlov
Copy link
Member

Also note that it's fine to pull std for the js backend, since js-sys (on which the backend depends) already pulls std unconditionally.

@newpavlov newpavlov closed this Feb 13, 2024
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.

Failed to build for wasm32-unknown-unknown with no_std
2 participants