Skip to content

Commit 0d5d54a

Browse files
authored
Merge pull request #569 from hron/rust-compilation-dbg!
Add compilation regexp to match ‘dbg!’ output
2 parents 25d91cf + 684f679 commit 0d5d54a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
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 rustc-dbg!-compilation-regexps
52+
(let ((re (concat "\\[" rustc-compilation-location "\\]")))
53+
(cons re '(2 3 4 0 1)))
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! rustc-dbg!-compilation-regexps))
96+
(add-to-list 'compilation-error-regexp-alist 'rust-dbg!)
8897
(add-hook 'next-error-hook #'rustc-scroll-down-after-next-error)))
8998

9099
;;; _

rust-mode-tests.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3693,6 +3693,7 @@ let b = 1;"
36933693
(insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n")
36943694
(insert " ::: file5.rs:12:34\n\n")
36953695
(insert "thread 'main' panicked at src/file7.rs:12:34:\n\n")
3696+
(insert "[src/file8.rs:159:5] symbol_value(SOME_VAR) = Some(\n\n")
36963697
;; should not match
36973698
(insert "werror found a -> b\n --> no_match.rs:12:34\n\n")
36983699
(insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34
@@ -3712,12 +3713,14 @@ let b = 1;"
37123713
(("file5.rs" "12" "34" compilation-info "file5.rs:12:34"))
37133714
((like-previous-one "82" back-to-indentation compilation-info "82")
37143715
(like-previous-one "132" back-to-indentation compilation-info "132"))
3715-
(("src/file7.rs" "12" "34" nil "src/file7.rs:12:34")))
3716+
(("src/file7.rs" "12" "34" nil "src/file7.rs:12:34"))
3717+
(("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5")))
37163718
(mapcar #'rust-collect-matches
37173719
(list rustc-compilation-regexps
37183720
rustc-colon-compilation-regexps
37193721
rustc-refs-compilation-regexps
3720-
rustc-panics-compilation-regexps))))))
3722+
rustc-panics-compilation-regexps
3723+
rustc-dbg!-compilation-regexps))))))
37213724

37223725
;; If electric-pair-mode is available, load it and run the tests that use it. If not,
37233726
;; no error--the tests will be skipped.

0 commit comments

Comments
 (0)