Skip to content

Commit 75cc63b

Browse files
authored
Merge pull request #565 from cydparser/backtrace-regexp
Add regexp for stack backtrace locations
2 parents 8cfcdd1 + 7b5e5e3 commit 75cc63b

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
@@ -28,6 +28,12 @@ See `compilation-error-regexp-alist' for help on their format.")
2828
"Specifications for matching `:::` hints in rustc invocations.
2929
See `compilation-error-regexp-alist' for help on their format.")
3030

31+
(defvar rustc-backtrace-compilation-regexps
32+
(let ((re (concat "^ +at " rustc-compilation-location)))
33+
(cons re '(2 3 4 0 1)))
34+
"Specifications for matching stack backtraces in rustc invocations.
35+
See `compilation-error-regexp-alist' for help on their format.")
36+
3137
(defvar rustc-refs-compilation-regexps
3238
(let ((re "^\\([0-9]+\\)[[:space:]]*|"))
3339
(cons re '(nil 1 nil 0 1)))
@@ -85,6 +91,9 @@ the compilation window until the top of the error is visible."
8591
(add-to-list 'compilation-error-regexp-alist-alist
8692
(cons 'rustc-colon rustc-colon-compilation-regexps))
8793
(add-to-list 'compilation-error-regexp-alist 'rustc-colon)
94+
(add-to-list 'compilation-error-regexp-alist-alist
95+
(cons 'rustc-backtrace rustc-backtrace-compilation-regexps))
96+
(add-to-list 'compilation-error-regexp-alist 'rustc-backtrace)
8897
(add-to-list 'compilation-error-regexp-alist-alist
8998
(cons 'cargo cargo-compilation-regexps))
9099
(add-to-list 'compilation-error-regexp-alist-alist

rust-mode-tests.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3694,6 +3694,7 @@ let b = 1;"
36943694
(insert " ::: file5.rs:12:34\n\n")
36953695
(insert "thread 'main' panicked at src/file7.rs:12:34:\n\n")
36963696
(insert "[src/file8.rs:159:5] symbol_value(SOME_VAR) = Some(\n\n")
3697+
(insert " at file9.rs:12:34\n\n")
36973698
;; should not match
36983699
(insert "werror found a -> b\n --> no_match.rs:12:34\n\n")
36993700
(insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34
@@ -3714,13 +3715,15 @@ let b = 1;"
37143715
((like-previous-one "82" back-to-indentation compilation-info "82")
37153716
(like-previous-one "132" back-to-indentation compilation-info "132"))
37163717
(("src/file7.rs" "12" "34" nil "src/file7.rs:12:34"))
3717-
(("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5")))
3718+
(("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5"))
3719+
(("file9.rs" "12" "34" compilation-info "file9.rs:12:34")))
37183720
(mapcar #'rust-collect-matches
37193721
(list rustc-compilation-regexps
37203722
rustc-colon-compilation-regexps
37213723
rustc-refs-compilation-regexps
37223724
rustc-panics-compilation-regexps
3723-
rustc-dbg!-compilation-regexps))))))
3725+
rustc-dbg!-compilation-regexps
3726+
rustc-backtrace-compilation-regexps))))))
37243727

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

0 commit comments

Comments
 (0)