`std::arch::wasm::unreachable()` is stable but does not compile
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried to build this code with cargo build --target=wasm32-unknown-unknown:
pub fn force_wasm_trap() {
std::arch::wasm::unreachable();
}
I expected to see this happen: compile succeeds, generates a function containing the wasm "unreachable" instruction, which is what the documentation says it does.
Instead, this happened:
error[E0658]: use of unstable library feature 'simd_wasm64'
--> src/lib.rs:2:5
|
2 | std::arch::wasm::unreachable();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #90599 <https://github.com/rust-lang/rust/issues/90599> for more information
For more information about this error, try `rustc --explain E0658`.
I don't understand what happened: the documentation says this has been stable since rust 1.37.0, and I don't think there's any reason why the webassembly "unreachable" instruction would be tied to the unstable "simd_wasm64" feature.
I also tried with and without #[no_std] and using both core::arch and std::arch: all fail the same way.
Meta
rustc --version --verbose:
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.82.0
LLVM version: 19.1.1
The same error happens with 1.83.0-beta.5 and nightly-2024-11-12.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example with cargo build --target=wasm32-unknown-unknown and inspect the std::arch::wasm::unreachable entry point alongside issue #90599. Done means the documented stable API compiles on the wasm target and generates the WebAssembly unreachable instruction without requiring simd_wasm64.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100