Skip to content

Commit e2f32e5

Browse files
felipebalbiCopilot
andcommitted
build: enable bulk-memory in release wasm-opt
runk build --release failed with a flood of wasm-validator errors along the lines of: [wasm-validator error in function NNNN] unexpected false: memory.copy operations require bulk memory operations [--enable-bulk-memory-opt] Trunk's bundled wasm-opt (binaryen v123) does not enable the bulk-memory feature by default, but rustc 1.82+ (and several of our dependencies) emit `memory.copy` instructions, so wasm-opt rejects the staged wasm before it can be optimised. Forward `--enable-bulk-memory` and `--enable-nontrapping-float-to-int` to wasm-opt via Trunk's `data-wasm-opt-params` attribute on the `rust` link in `index.html`. These are the same target features the rustc wasm32 target enables, so the optimiser now accepts the input and the release pipeline succeeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent db5f3cc commit e2f32e5

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

index.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@
1515
<script defer src="https://d3js.org/d3.v7.min.js"></script>
1616
<script defer src="/repo_graph.js"></script>
1717

18-
<link data-trunk rel="rust" data-wasm-opt="z" data-keep-debug="false" data-weak-refs />
18+
<!--
19+
`data-wasm-opt-params` forwards extra flags to wasm-opt. The bundled
20+
wasm-opt v123 has bulk-memory disabled by default, but rustc 1.82+
21+
emits `memory.copy` instructions, which fail validation. The two
22+
`--enable-*` flags below match the features the rustc target enables.
23+
-->
24+
<link
25+
data-trunk
26+
rel="rust"
27+
data-wasm-opt="z"
28+
data-wasm-opt-params="--enable-bulk-memory --enable-nontrapping-float-to-int"
29+
data-keep-debug="false"
30+
data-weak-refs
31+
/>
1932
<link rel="icon" href="images/odpicon.ico" type="image/x-icon">
2033
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap" rel="stylesheet">
2134
</head>

0 commit comments

Comments
 (0)