From ea5ab25d3844a26f3e118dc0a4e632d10a05ed18 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Fri, 14 Jun 2024 09:21:56 -0400 Subject: [PATCH] Run `std/optimize_for_size` in nightly CI (#65) --- .github/workflows/build.yml | 2 +- README.md | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec85312..410e11c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,5 +75,5 @@ jobs: working-directory: ${{ matrix.project_dir }} run: > rustup component add rust-src; - RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort --target x86_64-unknown-linux-gnu --release; + RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features="std/optimize_for_size" --target x86_64-unknown-linux-gnu --release; cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release; diff --git a/README.md b/README.md index 9ecd214..6b37584 100644 --- a/README.md +++ b/README.md @@ -209,10 +209,11 @@ $ RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic --target x86_64-apple-darwin --release ``` -On macOS, the final stripped binary size is reduced to 51KB. +The `optimize_for_size` flag provides a hint to `libstd` that it should try to use algorithms +optimized for binary size. More information about it can be found in the +[tracking issue](https://github.com/rust-lang/rust/issues/125612). -The `optimize_for_size` flag provides a hint to libstd that it should try to use algorithms optimized -for binary size. More information about it can be found [here](https://github.com/rust-lang/rust/issues/125612). +On macOS, the final stripped binary size is reduced to 51KB. # Remove `panic` String Formatting with `panic_immediate_abort`