Skip to content

rust 1.82.0 wasm32-unknown-unknown triggers issues with wasm-bindgen >= 0.2.94 #132620

Closed
@eric-seppanen

Description

@eric-seppanen

I found that a wasm project that builds under Trunk with Rust 1.81.0, no longer builds with Rust 1.82.0. This seems to be because rustc now emits wasm "bulk memory" instructions that Trunk's bundled wasm-opt can't deal with. I haven't found any documented reason why this changed between 1.81.0 and 1.82.0, so I fear it may have been accidentally introduced by the switch to LLVM 19, which was documented to enable two other target-features (but not "bulk memory").

Code

I minimized an affected project, which can be found here: https://github.com/eric-seppanen/wasm_test_2024
It's not very well minimized, because the problem appears when using the gloo crate, which has a large dependency tree.

I expected to see this happen: project builds under rust 1.82.0, just like it does under 1.81.0, and the emitted code is compatible with Trunk and wasm-opt v116 that is bundled with Trunk.

Instead, this happened: trunk fails to build because:

  • rustc emitted wasm code containing "bulk memory" instructions
  • trunk's bundled wasm-opt binary does not understand "bulk memory" instructions.

The rustc book contains a list of wasm target features that are enabled by default. The bulk-memory feature is not listed among them.

Version it worked on

It most recently worked on: 1.81.0

Version with regression

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

I also filed an issue with Trunk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler 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