Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions rust-compile.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ See `compilation-error-regexp-alist' for help on their format.")
"Specifications for matching `:::` hints in rustc invocations.
See `compilation-error-regexp-alist' for help on their format.")

(defvar rustc-backtrace-compilation-regexps
(let ((re (concat "^ +at " rustc-compilation-location)))
(cons re '(2 3 4 0 1)))
"Specifications for matching stack backtraces in rustc invocations.
See `compilation-error-regexp-alist' for help on their format.")

(defvar rustc-refs-compilation-regexps
(let ((re "^\\([0-9]+\\)[[:space:]]*|"))
(cons re '(nil 1 nil 0 1)))
Expand Down Expand Up @@ -85,6 +91,9 @@ the compilation window until the top of the error is visible."
(add-to-list 'compilation-error-regexp-alist-alist
(cons 'rustc-colon rustc-colon-compilation-regexps))
(add-to-list 'compilation-error-regexp-alist 'rustc-colon)
(add-to-list 'compilation-error-regexp-alist-alist
(cons 'rustc-backtrace rustc-backtrace-compilation-regexps))
(add-to-list 'compilation-error-regexp-alist 'rustc-backtrace)
(add-to-list 'compilation-error-regexp-alist-alist
(cons 'cargo cargo-compilation-regexps))
(add-to-list 'compilation-error-regexp-alist-alist
Expand Down
7 changes: 5 additions & 2 deletions rust-mode-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3694,6 +3694,7 @@ let b = 1;"
(insert " ::: file5.rs:12:34\n\n")
(insert "thread 'main' panicked at src/file7.rs:12:34:\n\n")
(insert "[src/file8.rs:159:5] symbol_value(SOME_VAR) = Some(\n\n")
(insert " at file9.rs:12:34\n\n")
;; should not match
(insert "werror found a -> b\n --> no_match.rs:12:34\n\n")
(insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34
Expand All @@ -3714,13 +3715,15 @@ let b = 1;"
((like-previous-one "82" back-to-indentation compilation-info "82")
(like-previous-one "132" back-to-indentation compilation-info "132"))
(("src/file7.rs" "12" "34" nil "src/file7.rs:12:34"))
(("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5")))
(("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5"))
(("file9.rs" "12" "34" compilation-info "file9.rs:12:34")))
(mapcar #'rust-collect-matches
(list rustc-compilation-regexps
rustc-colon-compilation-regexps
rustc-refs-compilation-regexps
rustc-panics-compilation-regexps
rustc-dbg!-compilation-regexps))))))
rustc-dbg!-compilation-regexps
rustc-backtrace-compilation-regexps))))))

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