From 60bbe8786a7851e29e520fd187112e55cf44c34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20=C5=9Awierk?= Date: Sun, 1 Mar 2026 14:42:43 +0100 Subject: [PATCH] Add Rust panic message pattern (bug#80403) * etc/compilation.txt: Add example. * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): New rule. * test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data) (compile-test-error-regexps): Add test case. Copyright-paperwork-exempt: yes --- etc/compilation.txt | 5 ++++- lisp/progmodes/compile.el | 12 ++++++++++++ test/lisp/progmodes/compile-tests.el | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/etc/compilation.txt b/etc/compilation.txt index c2a0967c6a5..801d262f5aa 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -489,7 +489,7 @@ Fatal error: Call to undefined function: mysql_pconnect() in db.inc on line 66 * Rust -symbol: rust +symbol: rust rust-panic error[E0277]: `Foo` is not an iterator --> src/main.rs:4:16 @@ -498,6 +498,9 @@ warning: borrow of packed field is unsafe and requires unsafe function or block note: required by a bound in `Trait` --> src/auxiliary/trait-debuginfo.rs:23:18 +thread 'main' (1234) panicked at library/std/src/io/stdio.rs:30:40: + thread 'main' (1234) panicked at library/std/src/io/stdio.rs:50:60: + * Ruby symbol: ruby diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index d2e92d7da8b..9c805b96b43 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -405,6 +405,18 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) (ruby-Test::Unit "^ [[ ]?\\([^ (].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2) + (rust-panic + ,(rx bol (opt " ") + "thread '" (+ nonl) "' " (? "(" (+ digit) ") ") + (group-n 1 "panicked" ) " at" + " " (group-n 2 (+ nonl)) ; file + ":" (group-n 3 (+ digit)) ; line + ":" (group-n 4 (+ digit)) ; column + ":" eol) + 2 3 4 nil + nil + (1 compilation-error-face)) + ;; Tested with Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT 2.1. (lua ,(rx bol diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index eeb8fcf6eee..67a713857e3 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -384,6 +384,10 @@ (rust "note: required by a bound in `Trait`\n --> src/auxiliary/trait-debuginfo.rs:23:18" 1 18 23 "src/auxiliary/trait-debuginfo.rs" info) + (rust-panic "thread 'main' (1234) panicked at library/std/src/io/stdio.rs:30:40:" + 1 40 30 "library/std/src/io/stdio.rs" error) + (rust-panic " thread 'main' (1234) panicked at library/std/src/io/stdio.rs:50:60:" + 1 60 50 "library/std/src/io/stdio.rs" error) ;; ruby (uses gnu) (gnu "plain-exception.rb:7:in `fun': unhandled exception" 1 nil 7 "plain-exception.rb" error) @@ -552,7 +556,7 @@ The test data is in `compile-tests--test-regexps-data'." 1 15 5 "alpha.c"))) (compile--test-error-line test)) - (should (eq compilation-num-errors-found 108)) + (should (eq compilation-num-errors-found 110)) (should (eq compilation-num-warnings-found 37)) (should (eq compilation-num-infos-found 36)))))