Add wasm64-unknown-unknown target support#1553
Open
audreyt wants to merge 1 commit intodrager:masterfrom
Open
Conversation
- Parameterize target triple in cargo_build_wasm() and cargo_build_wasm_tests() - Extract --target from extra_options in build and test commands - Add --enable-memory64 to wasm-opt args for wasm64 targets - Construct CARGO_TARGET_*_RUNNER env var dynamically from target triple - Pass target triple through to cargo_test_wasm() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend wasm-pack to support
wasm64-unknown-unknowntargets alongside existingwasm32support, enablingwasm-pack buildandwasm-pack testto work with WebAssembly memory64 modules.Closes #1464.
Motivation
The WebAssembly memory64 proposal has reached standardization phase, and Rust nightly ships a
wasm64-unknown-unknowntarget. The underlying toolchain now has wasm-bindgen#5004 implements for memory64 codegen support, and downstreamgetrandomhas a corresponding PR at getrandom#819. wasm-pack is the last piece: its build and test pipelines hardcodewasm32-unknown-unknownas the target triple, sowasm-pack build --target wasm64-unknown-unknownsilently ignores the user's intent.Changes
5 files changed (+49 −29) — all mechanical plumbing to thread the target triple through instead of hardcoding it:
src/build/mod.rs— Parameterizecargo_build_wasm()andcargo_build_wasm_tests()to accept atarget_tripleargument instead of hardcodingwasm32-unknown-unknownviaCARGO_BUILD_TARGETsrc/command/build.rs— Passself.target_triplethrough tocargo_build_wasm(); add--enable-memory64to wasm-opt args when the target starts withwasm64src/command/test.rs— Extract--targetfromextra_options(defaulting towasm32-unknown-unknown); constructCARGO_TARGET_<TRIPLE>_RUNNERenv var dynamically instead of hardcodingCARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER; threadtarget_triplethrough to all test steps (node, Chrome, Firefox, Safari) andwebdriver_env()src/test/mod.rs— Parameterizecargo_test_wasm()to accepttarget_tripleand pass it tocargo test --targetsrc/manifest/mod.rs— Generalize the cdylib error message from "wasm32-unknown-unknown" to "WebAssembly"Usage
The
-- --target wasm64-unknown-unknownis passed through as a Cargo extra option. When omitted, behavior is unchanged (wasm32-unknown-unknown).Testing
wasm-pack buildwith wasm32 targets is unchanged (no regressions)wasm64-unknown-unknown— a 1.7B parameter LLM inference engine that requires >4 GB memory