rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
95.68k stars 12.33k forks source link

Confusing documentation for wasm32-wasip1-threads #126857

Open veluca93 opened 1 month ago

veluca93 commented 1 month ago

Location

https://doc.rust-lang.org/rustc/platform-support/wasm32-wasip1-threads.html#building-the-target

Summary

The section seems to suggest to add

[target.wasm32-wasip1-threads]
wasi-root = ".../wasi-libc/sysroot"

to use with cargo build -Zbuild-std in a crate, but doing so results in the following error:

error: expected a table, but found a string for `target.wasm32-wasip1-threads.wasi-root` .../.cargo/config.toml
bjorn3 commented 1 month ago

The documentation here is incorrect. wasi-root only exists for the config.toml used for building rustc itself. Not for .cargo/config.toml. And I don't think -Zbuild-std works either. Unless you are working on rustc itself I would suggest following the instructions at https://doc.rust-lang.org/rustc/platform-support/wasm32-wasip1-threads.html#building-rust-programs instead.