Skip to content

Commit a8f724e

Browse files
Chore: Optimize binary size.
1 parent 730ea3d commit a8f724e

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/_wasm.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
with:
1919
workspaces: compiler
2020

21-
- uses: dtolnay/rust-toolchain@stable
21+
- uses: dtolnay/rust-toolchain@nightly
22+
with:
23+
components: rust-src
2224

2325
- name: Install wasm target
2426
run: rustup target add wasm32-unknown-unknown
@@ -31,7 +33,8 @@ jobs:
3133
wasm-opt --version
3234
3335
- name: Build
34-
run: cargo build --target wasm32-unknown-unknown --features wasm --lib --release
36+
run: |
37+
cargo +nightly build --target wasm32-unknown-unknown --features wasm --lib --release -Z build-std=core,alloc,panic_abort -Z build-std-features=panic_immediate_abort
3538
working-directory: compiler
3639

3740
- name: Size (unoptimized)

compiler/.cargo/config.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# .cargo/config.toml
2+
3+
[target.wasm32-unknown-unknown]
4+
rustflags = [
5+
"-Zlocation-detail=none",
6+
"-Zfmt-debug=none",
7+
]
8+
9+
[unstable]
10+
build-std = ["core", "alloc", "panic_abort"]
11+
build-std-features = ["panic_immediate_abort"]

0 commit comments

Comments
 (0)