Skip to content

Commit eae3cd5

Browse files
authored
Switch to new panic=immediate-abort flag (#86)
1 parent b0bc6dc commit eae3cd5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ jobs:
7676
run: >
7777
rustup component add rust-src;
7878
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features="optimize_for_size" --target x86_64-unknown-linux-gnu --release;
79-
cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release;
79+
RUSTFLAGS="-Zunstable-options -Cpanic=immediate-abort" cargo +nightly build -Z build-std=std,panic_abort --target x86_64-unknown-linux-gnu --release;

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,21 @@ optimized for binary size. More information about it can be found in the
220220

221221
On macOS, the final stripped binary size is reduced to 51KB.
222222

223-
# Remove `panic` String Formatting with `panic_immediate_abort`
223+
# Remove `panic` String Formatting with `panic=immediate-abort`
224224

225225
![Minimum Rust: Nightly](https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg)
226226

227227
Even if `panic = "abort"` is specified in `Cargo.toml`, `rustc` will still include panic strings
228228
and formatting code in final binary by default.
229-
[An unstable `panic_immediate_abort` feature](https://github.com/rust-lang/rust/pull/55011)
229+
[An unstable `panic=immediate-abort` feature](https://github.com/rust-lang/rust/pull/146317)
230230
has been merged into the `nightly` `rustc` compiler to address this.
231231

232-
To use this, repeat the instructions above to use `build-std`, but also pass the following
233-
[`-Z build-std-features=panic_immediate_abort`](https://doc.rust-lang.org/cargo/reference/unstable.html#build-std-features)
234-
option.
232+
To use this, repeat the instructions above to use `build-std`, but also pass
233+
[`-Zunstable-options -Cpanic=immediate-abort`](https://doc.rust-lang.org/rustc/command-line-arguments.html#-z-set-unstable-options)
234+
to `rustc`.
235235

236236
```bash
237-
$ cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort \
237+
$ RUSTFLAGS="-Zunstable-options -Cpanic=immediate-abort" cargo +nightly build -Z build-std=std,panic_abort \
238238
--target x86_64-apple-darwin --release
239239
```
240240

@@ -252,7 +252,7 @@ we will restrict our usage of `libstd` in order to reduce binary size further.
252252

253253
If you want an executable smaller than 20 kilobytes, Rust's string formatting code,
254254
[`core::fmt`](https://doc.rust-lang.org/core/fmt/index.html) must
255-
be removed. `panic_immediate_abort` only removes some usages of this code. There is a lot of other
255+
be removed. `panic=immediate-abort` only removes some usages of this code. There is a lot of other
256256
code that uses formatting in some cases. That includes Rust's "pre-main" code in `libstd`.
257257

258258
By using a C entry point (by adding the `#![no_main]` attribute) , managing stdio manually, and

0 commit comments

Comments
 (0)