@@ -220,21 +220,21 @@ optimized for binary size. More information about it can be found in the
220
220
221
221
On macOS, the final stripped binary size is reduced to 51KB.
222
222
223
- # Remove ` panic ` String Formatting with ` panic_immediate_abort `
223
+ # Remove ` panic ` String Formatting with ` panic=immediate-abort `
224
224
225
225
![ Minimum Rust: Nightly] ( https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg )
226
226
227
227
Even if ` panic = "abort" ` is specified in ` Cargo.toml ` , ` rustc ` will still include panic strings
228
228
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 )
230
230
has been merged into the ` nightly ` ` rustc ` compiler to address this.
231
231
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 ` .
235
235
236
236
``` 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 \
238
238
--target x86_64-apple-darwin --release
239
239
```
240
240
@@ -252,7 +252,7 @@ we will restrict our usage of `libstd` in order to reduce binary size further.
252
252
253
253
If you want an executable smaller than 20 kilobytes, Rust's string formatting code,
254
254
[ ` 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
256
256
code that uses formatting in some cases. That includes Rust's "pre-main" code in ` libstd ` .
257
257
258
258
By using a C entry point (by adding the ` #![no_main] ` attribute) , managing stdio manually, and
0 commit comments