Closed
Description
Compilation of any code using the atomics feature flag for the wasm target fails when building the std library due to the following error:
No function or associated item named get_name found for struct pal::wasm::thread::Thread in the current scope.
I tried this code:
fn main() {
println!("Hello, world!");
}
With these flags enabled
$env:RUSTFLAGS='-C target-feature=+atomics'
cargo build --target wasm32-unknown-unknown -Z build-std=std
I expected to see this happen:
Compilation succesful
Finished dev [unoptimized + debuginfo] target(s) in 0.59s
Instead, this happened:
error[E0599]: no function or associated item named `get_name` found for struct `pal::wasm::thread::Thread` in the current scope
--> \toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys_common\thread_info.rs:28:88
|
28 | thread_info.thread.get_or_init(|| Thread::new(sys::thread::Thread::get_name()));
| ^^^^^^^^ function or associated item not found in `Thread`
|
::: \toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\pal\wasm\atomics\thread.rs:7:1
|
7 | pub struct Thread(!);
| ----------------- function or associated item `get_name` not found for this struct
|
error: could not compile `std` (lib) due to 1 previous error
Meta
rustc --version --verbose
:
rustc 1.78.0-nightly (5119208fd 2024-03-02)
binary: rustc
commit-hash: 5119208fd78a77547c705d1695428c88d6791263
commit-date: 2024-03-02
host: x86_64-pc-windows-msvc
release: 1.78.0-nightly
LLVM version: 18.1.0
Backtrace
Backtrace doesn't seem to add useful information.