Skip to content

Commit

Permalink
Remove panic="abort" from dev builds
Browse files Browse the repository at this point in the history
The `backtrace` crate isn't compatible with `panic="abort"` (see
[docs](https://docs.rs/backtrace/latest/backtrace/) and
[issue](rust-lang/backtrace-rs#397)).

One great feature we have in egui is pressing down all modifier keys
on your keyboard and seeing the backtrace to the widget you hover.
This is awesome for when you want to change the code for some
specific part of the UI. But it didn't work, at least not always.

This PR fixes it.

We still use `panic="abort"` in release builds, for the benefit
of smaller binaries.

* See also emilk/egui#4696
  • Loading branch information
emilk committed Jun 23, 2024
1 parent 4b6bc9e commit e7c15e4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ zip = { version = "0.6", default-features = false }

# Our dev profile has some optimizations turned on, as well as debug assertions.
[profile.dev]
opt-level = 1 # Make debug builds run faster
panic = "abort" # This leads to better optimizations and smaller binaries (and is the default in Wasm anyways).
opt-level = 1 # Make debug builds run faster

# panic = "abort" leads to better optimizations and smaller binaries (and is the default in Wasm anyways),
# but it also means backtraces don't work with the `backtrace` library (https://github.com/rust-lang/backtrace-rs/issues/397).
# egui has a feature where if you hold down all modifiers keys on your keyboard and hover any UI widget,
# you will see the backtrace to that widget, and we don't want to break that feature.

[profile.dev.build-override]
debug = true # enable debug symbols for build scripts when building in dev (codegen backtraces!)
Expand Down

0 comments on commit e7c15e4

Please sign in to comment.