TL;DR
Rust's WebAssembly compilation previously allowed undefined symbol references using the --allow-undefined flag in wasm-ld (the WebAssembly linker). This permissive flag is being removed from all WebAssembly targets.
✦ Why It Matters
Update WebAssembly projects to resolve undefined symbols before the --allow-undefined flag removal breaks your builds.
Key Takeaways
Full Summary
Rust's WebAssembly targets have historically used the --allow-undefined flag during linking, allowing undefined symbols to be ignored. This flag's removal is intended to prevent potential runtime errors caused by misconfigurations, as it introduces a divergence from how other platforms handle undefined symbols.
For instance, if a symbol like mylibrary_init is misspelled, the final binary would import it instead of generating a linker error, leading to confusion. The change is expected to improve diagnostics by flagging unresolved imports, making it easier for developers to identify issues early.
Users who depend on the previous behavior can adapt their code using the #[link] attribute to specify the import module name or temporarily restore the old behavior with a compiler flag. This change is set to be implemented in Rust 1.96, scheduled for release on May 28, 2026.
Related