-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
This was very hard to pin-point!
The background is that I am using wasmtime with the Component Model to run components that I am creating from Rust + wit-bindgen targeting wasm32-wasip2.
I noticed something very odd. The debug builds of my Wasm worked fine, but release builds caused some very weird errors from wasmtime.
After a lot of trial-and-error I discovered that the issue only happens when going beyond opt-level 1. Essentially running cargo build with CARGO_PROFILE_RELEASE_OPT_LEVEL=1 solved the problem.
I further discovered that this issue doesn't happen when using cargo +nightly build, which can use the default opt-level 3 without a problem.
This might be a known issue. If it's solved in nightly, that means it might find its way to the standard channel.
However, just in case this is a fluke (or other people encounter this bug and search for solutions), hopefully this issue will help track it.
Meta
rustc --version --verbose:
rustc 1.91.0 (f8297e351 2025-10-28)
binary: rustc
commit-hash: f8297e351a40c1439a467bbbb6879088047f50b3
commit-date: 2025-10-28
host: x86_64-unknown-linux-gnu
release: 1.91.0
LLVM version: 21.1.2
rustc +nightly --version --verbose:
rustc 1.93.0-nightly (843f8ce2e 2025-11-07)
binary: rustc
commit-hash: 843f8ce2ebc01d35a30484eadc8a84cdc6130844
commit-date: 2025-11-07
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.3