From 08bd4b8184c6c41be3d3ef6aaa5d4ebf029ddc83 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Fri, 14 Jun 2024 09:18:17 -0400 Subject: [PATCH 1/2] Run `std/optimize_for_size` in nightly CI --- .github/workflows/build.yml | 2 +- README.md | 5 +++-- 2 files changed, 4 insertions(+), 3 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..c69a177 100644 --- a/README.md +++ b/README.md @@ -211,8 +211,9 @@ $ RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic 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 [here](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 in the +[tracking issue](https://github.com/rust-lang/rust/issues/125612). # Remove `panic` String Formatting with `panic_immediate_abort` From 9e8e503aa413b4095d027b2a3bff25c0f8a2ee15 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Fri, 14 Jun 2024 09:19:42 -0400 Subject: [PATCH 2/2] Move `optimize_for_size` paragraph up --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c69a177..6b37584 100644 --- a/README.md +++ b/README.md @@ -209,12 +209,12 @@ $ 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). +On macOS, the final stripped binary size is reduced to 51KB. + # Remove `panic` String Formatting with `panic_immediate_abort` ![Minimum Rust: Nightly](https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg)