Skip to content

Commit bf1b2d4

Browse files
committed
Add compilation regexp to match ‘dbg!’ output
While debugging tests it’s annoying when ‘compilation-mode’ matches ‘dbg!’ output incorrectly. Currently, rust-mode’s regexps assign it as an error and incorrectly include ‘[’. The proposed change adds a regexp to match such things and assign them info level.
1 parent 25d91cf commit bf1b2d4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rust-compile.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ See `compilation-error-regexp-alist' for help on their format.")
4848
"Specifications for matching panics in cargo test invocations.
4949
See `compilation-error-regexp-alist' for help on their format.")
5050

51+
(defvar rust-dbg!-compilation-regexp
52+
'("\\[\\([^:]+\\):\\([0-9]+\\):\\([0-9]+\\)\\]"
53+
1 2 3 0)
54+
"Specifications for matching dbg! output.
55+
See `compilation-error-regexp-alist' for help on their format.")
56+
5157
(defun rustc-scroll-down-after-next-error ()
5258
"In the new style error messages, the regular expression
5359
matches on the file name (which appears after `-->`), but the
@@ -85,6 +91,9 @@ the compilation window until the top of the error is visible."
8591
(cons 'rustc-panics rustc-panics-compilation-regexps))
8692
(add-to-list 'compilation-error-regexp-alist 'rustc-panics)
8793
(add-to-list 'compilation-error-regexp-alist 'cargo)
94+
(add-to-list 'compilation-error-regexp-alist-alist
95+
(cons 'rust-dbg! rust-dbg!-compilation-regexp))
96+
(add-to-list 'compilation-error-regexp-alist 'rust-dbg!)
8897
(add-hook 'next-error-hook #'rustc-scroll-down-after-next-error)))
8998

9099
;;; _

0 commit comments

Comments
 (0)