Skip to content

std::arch::wasm::unreachable() is stable but does not compile #133015

Open
@eric-seppanen

Description

@eric-seppanen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-stabilityArea: `#[stable]`, `#[unstable]` etc.D-imprecise-spansDiagnostics: spans don't point to exactly the erroneous codeD-papercutDiagnostics: An error or lint that needs small tweaks.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions