Skip to content

Build wasm32-uknown-unknown failed with atomics feature #145101

@Spxg

Description

@Spxg

Steps to reproduce:

cargo new hello --lib && cd hello
RUSTFLAGS="-C target-feature=+atomics" cargo build --target wasm32-unknown-unknown -Zbuild-std=std,panic_abort

Output:

error[E0425]: cannot find function `current_os_id` in module `imp`
   --> /home/uharsn/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/current.rs:159:10
    |
159 |     imp::current_os_id().unwrap_or_else(|| current_id().as_u64().get())
    |          ^^^^^^^^^^^^^ not found in `imp`
    |
help: consider importing this function through its public re-export
    |
  1 + use crate::thread::current_os_id;
    |
help: if you import `current_os_id`, refer to it directly
    |
159 -     imp::current_os_id().unwrap_or_else(|| current_id().as_u64().get())
159 +     current_os_id().unwrap_or_else(|| current_id().as_u64().get())
    |

rustc --version --verbose:

rustc 1.91.0-nightly (2fd855fbf 2025-08-07)
binary: rustc
commit-hash: 2fd855fbfc8239285aa2d596f76a8cc75e17ce02
commit-date: 2025-08-07
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

PR: #145096

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions