summaryrefslogtreecommitdiff
path: root/rust-compile.el
diff options
context:
space:
mode:
authorAleksei Gusev <aleksei.gusev@gmail.com>2025-06-08 23:49:40 +0300
committerAleksei Gusev <aleksei.gusev@gmail.com>2025-06-09 15:43:06 +0300
commit684f67938c7f7e8c0f3cee638f03f2603e0e1e3f (patch)
tree81c2dd704c45c75162e6fab684129c18fde03847 /rust-compile.el
parent25d91cff281909e9b7cb84e31211c4e7b0480f94 (diff)
downloadrust-mode-684f67938c7f7e8c0f3cee638f03f2603e0e1e3f.tar.gz
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.
Diffstat (limited to 'rust-compile.el')
-rw-r--r--rust-compile.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust-compile.el b/rust-compile.el
index 04ac6b6..abeb753 100644
--- a/rust-compile.el
+++ b/rust-compile.el
@@ -48,6 +48,12 @@ See `compilation-error-regexp-alist' for help on their format.")
"Specifications for matching panics in cargo test invocations.
See `compilation-error-regexp-alist' for help on their format.")
+(defvar rustc-dbg!-compilation-regexps
+ (let ((re (concat "\\[" rustc-compilation-location "\\]")))
+ (cons re '(2 3 4 0 1)))
+ "Specifications for matching dbg! output.
+See `compilation-error-regexp-alist' for help on their format.")
+
(defun rustc-scroll-down-after-next-error ()
"In the new style error messages, the regular expression
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."
(cons 'rustc-panics rustc-panics-compilation-regexps))
(add-to-list 'compilation-error-regexp-alist 'rustc-panics)
(add-to-list 'compilation-error-regexp-alist 'cargo)
+ (add-to-list 'compilation-error-regexp-alist-alist
+ (cons 'rust-dbg! rustc-dbg!-compilation-regexps))
+ (add-to-list 'compilation-error-regexp-alist 'rust-dbg!)
(add-hook 'next-error-hook #'rustc-scroll-down-after-next-error)))
;;; _