Dear node-source-map maintainers,

I have attached the patch that will fix the future build failure with Rust
1.96+. I have ensured it builds against both Rust 1.95 in Debian unstable
and Rust 1.97 in a test Ubuntu 26.10 PPA.

Please let me know if you need any more info.

Best wishes,
Max
Description: Fix mapping_callback import on Rust 1.96+
 Rust 1.96 stopped passing --allow-undefined to wasm-ld
 (https://github.com/rust-lang/rust/pull/149868). Previously, a bare extern "C"
 block on wasm32-unknown-unknown implicitly imported symbols from the "env"
 module. Now, as stated upstream
 (https://github.com/rust-lang/rust/pull/149868#issuecomment-3730522786),
 the link to env must be manually added.
Author: Max Gilmour <[email protected]>
Bug: https://github.com/mozilla/source-map/issues/530
Bug-Debian: https://bugs.debian.org/1142614
Forwarded: https://github.com/mozilla/source-map/pull/531
Last-Update: 2026-07-22
---
--- a/wasm-mappings/source-map-mappings-wasm-api/src/lib.rs
+++ b/wasm-mappings/source-map-mappings-wasm-api/src/lib.rs
@@ -251,6 +251,10 @@
     mappings.as_mut().unwrap()
 }
 
+// Since Rust 1.96 (rust-lang/rust#149868), wasm-ld is no longer invoked with
+// `--allow-undefined`. As the PR states, importing from `env` must now be
+// declared with the following line.
+#[link(wasm_import_module = "env")]
 extern "C" {
     fn mapping_callback(
         // These two parameters are always valid.

Reply via email to