Skip to content

Fix CI for latest rustc nightly#5152

Merged
guybedford merged 7 commits into
mainfrom
fix-wasm-heap-base-export
May 13, 2026
Merged

Fix CI for latest rustc nightly#5152
guybedford merged 7 commits into
mainfrom
fix-wasm-heap-base-export

Conversation

@guybedford

@guybedford guybedford commented May 8, 2026

Copy link
Copy Markdown
Contributor

This fixes CI on current nightly Rust (2026-05-06+) with two recent issues:

  1. modern exception handling is now the default as of
  2. atomics-flagged builds fail with failed to find \__heap_base` for injecting thread id`.

Use Node.js 24.15+ 22.22.3+

Node.js modern exception handling requires 22.22.3+ OR 24.15+.

We change the tests to use this version, and then explicitly turn on legacy exception handling for those tests.

Add --export=__heap_base for threading after rust-lang/rust#156174

rust-lang/rust#156174 (merged 2026-05-06) intentionally removed the implicit __heap_base/__data_end exports on wasm*-unknown-unknown and wasm32v1-none, requiring threading toolchains like wasm-bindgen to opt in explicitly. The PR description spells out the required link arg directly:

After this PR the following would be required for multi-threading support in wasm-bindgen:
... -Clink-arg=--shared-memory ... -Clink-arg=--export=__heap_base -Clink-arg=--export=__wasm_init_tls ...

wasm-bindgen's threading post-processing needs __heap_base (see crates/cli-support/src/transforms/threads/mod.rs:193) to set up per-thread stacks, so without the new export it bails immediately.

This PR adds -Clink-arg=--export=__heap_base everywhere the existing TLS exports are listed:

  • .github/workflows/main.yml — atomics CI rustflags
  • crates/cli/tests/wasm-bindgen/reference.rsruntest_targets_atomics and no_duplicate_wasm_export_in_node_esm_atomics_debug
  • examples/nodejs-threads/package.json
  • examples/raytrace-parallel/package.json
  • examples/wasm-audio-worklet/package.json

Verified locally: the fix makes the failing headless test pass on nightly-2026-05-07 (365c0e1d7), and remains backward-compatible with older nightlies (nightly-2026-05-06 / e95e73209).

Nightly Rust as of 2026-05-06 no longer implicitly exports
__heap_base/__data_end on wasm32-unknown-unknown. wasm-bindgen's
threading post-processing requires __heap_base, so callers must now
pass -Clink-arg=--export=__heap_base in RUSTFLAGS alongside the
existing TLS exports.

Updated:
* Atomics CI job rustflags
* CLI reference tests for atomics
* nodejs-threads, raytrace-parallel, wasm-audio-worklet examples

The flag is backward-compatible with older nightlies.
Comment thread CHANGELOG.md Outdated
@guybedford guybedford force-pushed the fix-wasm-heap-base-export branch from ee535b8 to 26da3c6 Compare May 13, 2026 00:29
rust-lang/rust#156061 flipped the wasm `-Cpanic=unwind` default from
legacy EH (try/catch) to modern (exnref) EH. Adjust CI and justfile so
the legacy EH path now requires an explicit `-Cllvm-args=-wasm-use-legacy-eh`
opt-in, while the unmarked `-Cpanic=unwind` invocations follow the new
modern default.

* legacy EH CI job now passes `-Cllvm-args=-wasm-use-legacy-eh` (Node 20
  remains fine since legacy EH is still validated there).
* exnref CI job drops the now-redundant `=false` opt-out and runs on
  Node 25 (modern EH needs V8 12.5+, i.e. Node 22.22.3+ or 24+).
* test_native bumped from Node 20 to 24 because the cli termination
  tests build with `-Cpanic=unwind` and now emit modern EH wasm.
* justfile: `test-wasm-bindgen-unwind` no longer needs the opt-out and
  `test-wasm-bindgen-unwind-eh` is renamed to
  `test-wasm-bindgen-unwind-legacy-eh` with the explicit legacy opt-in.

TODOs noted in CI to drop modern-EH jobs back to Node 22 LTS once
22.22.3 ships on 2026-05-13.
`-Cpanic=unwind` now emits modern (exnref) EH by default. Document the
runtime version requirement and how to opt into legacy EH for Node 20
compatibility.
Rename the Unreleased `Fixed` section to `Notices` (both entries are
nightly toolchain compatibility heads-ups rather than wasm-bindgen bug
fixes) and add an entry for rust-lang/rust#156061 flipping the wasm
panic=unwind EH default to modern (exnref).
Node 24.14 (current setup-node '24' resolution) still hits the
termination test failures; 24.15 is required for the cli termination
tests to pass with modern EH wasm.
@guybedford guybedford changed the title Add --export=__heap_base for threading after rust-lang/rust#156174 Fix CI for latest nightly May 13, 2026
@guybedford guybedford changed the title Fix CI for latest nightly Fix CI for latest rustc nightly May 13, 2026
Earlier comments said "Node 24+" but 24.14 still fails the termination
tests \u2014 24.15.0 is the actual minimum on the 24 line.
@guybedford guybedford merged commit 14b86ad into main May 13, 2026
63 of 65 checks passed
@guybedford guybedford deleted the fix-wasm-heap-base-export branch May 13, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants