From e51acd9dca6ac9d1eeb760a6574f837ae14d2e8c Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Thu, 19 Dec 2024 09:58:47 -0500 Subject: [PATCH] build: Make backtraces useable in release builds Having `panic = "abort"` and `strip = "symbols"` makes backtraces generated with `RUST_BACKTRACE=1` completely useless in release builds. By changing these options to `panic = "unwind"` and `strip = "debuginfo"` makes backtraces usable in release builds. This will help us debug issues we are unable to reproduce, since we can ask users to set `RUST_BACKTRACE=1` and provide the logs with this option. --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7d5ac40a90..f63805643b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,8 +112,8 @@ winapi = "0.3.9" # We optimize the release build for size. [profile.release] opt-level = "z" -panic = "abort" -strip = true # Strip symbols from the binary. -codegen-units = 1 # Parallel compilation prevents some optimizations. +panic = "unwind" # Abort makes backtraces useless. +strip = "debuginfo" # Only strip debuginfo (not symbols) to keep backtraces useful. +codegen-units = 1 # Parallel compilation prevents some optimizations. # We do not enable link-time optimizations (lto) because they cause the # CLI to timeout when run in Xcode Cloud.