Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove panic="abort" from dev builds #6608

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Jun 23, 2024

The backtrace crate isn't compatible with panic="abort" (see docs and issue).

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.

hover-backtrace.mp4

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

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
@emilk emilk added ui concerns graphical user interface 🧑‍💻 dev experience developer experience (excluding CI) exclude from changelog PRs with this won't show up in CHANGELOG.md labels Jun 23, 2024
@teh-cmc
Copy link
Member

teh-cmc commented Jun 24, 2024

The doc you linked to says:

You can remedy this, however, with -Cforce-unwind-tables as a compiler option.

Did that not work?

@emilk
Copy link
Member Author

emilk commented Jun 24, 2024

Unfortunately there is no way to add compile flags to Cargo.toml. I tried adding [build] rustflags = ["-C", "force-unwind-tables"] to .cargo/config with no effect.

@emilk emilk merged commit 27a3eba into main Jun 24, 2024
34 checks passed
@emilk emilk deleted the emilk/disable-panic-abort-in-dev-builds branch June 24, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧑‍💻 dev experience developer experience (excluding CI) exclude from changelog PRs with this won't show up in CHANGELOG.md ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants