Skip to content

std: add wasm64 to sync::Once and thread_parking atomics cfg guards#153174

Open
Trivo25 wants to merge 3 commits intorust-lang:mainfrom
Trivo25:fix-wasm64-sync-cfg
Open

std: add wasm64 to sync::Once and thread_parking atomics cfg guards#153174
Trivo25 wants to merge 3 commits intorust-lang:mainfrom
Trivo25:fix-wasm64-sync-cfg

Conversation

@Trivo25
Copy link

@Trivo25 Trivo25 commented Feb 27, 2026

When targeting wasm64-unknown-unknown with atomics enabled, std::sync::Once and thread_parking fall through to the no_threads/unsupported implementations because the cfg guards only check for wasm32. This causes worker threads to panic with unreachable at runtime. The underlying futex implementations already handle both wasm32 and wasm64 correctly, only the cfg guards were missing wasm64.

I tested this manually with a multithreaded wasm64 application (o1js) compiled with -Z build-std=panic_abort,std and -C target-feature=+atomics,+bulk-memory,+mutable-globals

Related: #83879 #77839

Happy to adjust anything based on feedback

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 27, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2026

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet

@joboet
Copy link
Member

joboet commented Feb 28, 2026

Thanks! Please apply Taiki's suggestions, then I'll approve merging.
@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 28, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 28, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 28, 2026
Trivo25 and others added 2 commits March 3, 2026 16:24
Co-authored-by: Taiki Endo <te316e89@gmail.com>
Co-authored-by: Taiki Endo <te316e89@gmail.com>
@Trivo25
Copy link
Author

Trivo25 commented Mar 3, 2026

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 3, 2026
@tgross35
Copy link
Contributor

tgross35 commented Mar 4, 2026

(squash before merge please)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants