Skip to content

Commit aad506d

Browse files
committed
Fix cargo compilation regex starting match
Previously this regex attempted to match the entire cargo output including the name of the thread that panicked and the entire panic message. In addition it was required that there be whitespace before the start of the word "thread" in that output. I don't know if this was the previous format, but in current Rust compilers "thread" comes at the beginning of the first line. However, there were two problems with this approach. One is that making that leading whitespace mandatory caused the regex to not match correctly. The second problem is that multiline regex matching in emacs is a bit iffy, and even matching the start correctly, if the panic message contained enough characters the full multiline regex could not be matched and the same problem would occur. This commit changes and vastly simplifies the regex to search for the guaranteed portion of the cargo output, starting with the ending `', `. This does come with an increased risk of accidentally matching input that is not actually a panic message, but I think in practice this will be fairly rare.
1 parent 494d59f commit aad506d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rust-compile.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ See `compilation-error-regexp-alist' for help on their format.")
3737
;; Match test run failures and panics during compilation as
3838
;; compilation warnings
3939
(defvar cargo-compilation-regexps
40-
'("^\\s-+thread '[^']+' panicked at \\('[^']+', \\([^:]+\\):\\([0-9]+\\)\\)"
41-
2 3 nil nil 1)
40+
'("', \\([^:]+\\):\\([0-9]+\\)"
41+
1 2 nil nil 0)
4242
"Specifications for matching panics in cargo test invocations.
4343
See `compilation-error-regexp-alist' for help on their format.")
4444

0 commit comments

Comments
 (0)