From 1ae0f68dba73c89a230d39e1730255673f87816e Mon Sep 17 00:00:00 2001 From: Matthew Planchard Date: Tue, 31 Mar 2026 15:37:03 -0400 Subject: [PATCH] Update rustic-compilation-panic regex In a recent Rust upgrade, my panic messages in tests now have an additional thread ID component after the initial `thread 'whatever'` portion of the message, like in: ``` thread 'crate::module::submodule::tests::test' (294268) panicked at lib/rs/mylib/src/module.rs:1282:76: ``` This feature was added to rustc here: https://github.com/rust-lang/rust/pull/115746 This no longer matches the current regex for `rustic-compilation-panic`, which expects nothing but a space between the module and the `"panicked"`. That then breaks the "jump to failing test" functionality in test compilation buffers. To fix, I added a component to the regex that allows that value to be optionally present. I also couldn't find any existing tests for the regex, so I added a simple one. Not sure if it's in the right location, or if it should be somewhere else. The test could be more sophisticated: it doesn't validate that the appropriate groups are present, just that the regex matches. --- rustic-compile.el | 2 +- test/rustic-compilation-error-tests.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rustic-compile.el b/rustic-compile.el index a8b3680..ccfad02 100644 --- a/rustic-compile.el +++ b/rustic-compile.el @@ -153,7 +153,7 @@ "Create hyperlink in compilation buffers for file paths preceded by ':::'.") (defvar rustic-compilation-panic - (let ((panic "thread '[^']+' panicked at ") + (let ((panic "thread '[^']+'\\(?: ([0-9]+)\\)? panicked at ") (file "\\([^\n]+\\)") (start-line "\\([0-9]+\\)") (start-col "\\([0-9]+\\)")) diff --git a/test/rustic-compilation-error-tests.el b/test/rustic-compilation-error-tests.el index e48ed78..9612e78 100644 --- a/test/rustic-compilation-error-tests.el +++ b/test/rustic-compilation-error-tests.el @@ -239,4 +239,10 @@ (should (string= default-directory test-workspace)) (should-not (get-text-property (point) 'compilation-message))))))) +(ert-deftest rustic-compilation-panic-regex () + (let* ((cases '("thread 'crate::module::submodule::tests::test' (294268) panicked at lib/rs/mylib/src/module.rs:1282:76:" + "thread 'crate::module::submodule::tests::test' panicked at lib/rs/mylib/src/module.rs:1282:76:"))) + (dolist (s cases) + (should (string-match (car rustic-compilation-panic) s))))) + (provide 'rustic-compilation-error-tests)