rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 176 forks source link

Match panics in `compilation-mode` #510

Closed luckysori closed 4 months ago

luckysori commented 4 months ago

Fixes https://github.com/rust-lang/rust-mode/issues/507.

If we encounter a panic when executing Rust code in compilation-mode, we now correctly highlight the location where the panic occurred.

For example:

thread 'main' panicked at src/main.rs:2:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here, src/main.rs:2:5 is highlighted. The developer is then able to execute compile-goto-error to jump to the correct spot in the code.

zachlefevre commented 4 months ago

@luckysori This looks ready for review to me. Do you mind running @rustbot review? from https://rustc-dev-guide.rust-lang.org/contributing.html#waiting-for-reviews ?

luckysori commented 4 months ago

@rustbot review

rustbot commented 4 months ago

Error: The feature shortcut is not enabled in this repository. To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

luckysori commented 4 months ago

Error: The feature shortcut is not enabled in this repository. To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

I guess it's not enabled on this repo, @zachlefevre.

zachlefevre commented 4 months ago

@psibi Do you mind reviewing this?

psibi commented 4 months ago

Thanks @zachlefevre for the review and @luckysori for the PR and the test case! I have confirmed that it works for me, merging this.