branch: elpa/rust-mode
commit f17e11ac890bcc8b91cf79e9b4dda66d5d9b97d6
Author: Kristoffer Grönlund <[email protected]>
Commit: Kristoffer Grönlund <[email protected]>
Match panics during build as compilation warnings
Enables using `cargo test` as the compilation command in emacs, and
adds test failures as compilation warnings.
---
rust-mode.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/rust-mode.el b/rust-mode.el
index 948cc0e..d15dee4 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -752,11 +752,21 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
"Specifications for matching errors in rustc invocations.
See `compilation-error-regexp-alist for help on their format.")
+;; Match test run failures and panics during compilation as
+;; compilation warnings
+(defvar cargo-compilation-regexps
+ '("^\\s-+thread '[^']+' panicked at \\('[^']+', \\([^:]+\\):\\([0-9]+\\)\\)"
2 3 nil nil 1)
+ "Specifications for matching panics in cargo test invocations.
+See `compilation-error-regexp-alist for help on their format.")
+
(eval-after-load 'compile
'(progn
(add-to-list 'compilation-error-regexp-alist-alist
(cons 'rustc rustc-compilation-regexps))
- (add-to-list 'compilation-error-regexp-alist 'rustc)))
+ (add-to-list 'compilation-error-regexp-alist 'rustc)
+ (add-to-list 'compilation-error-regexp-alist-alist
+ (cons 'cargo cargo-compilation-regexps))
+ (add-to-list 'compilation-error-regexp-alist 'cargo)))
;;; Functions to submit (parts of) buffers to the rust playpen, for
;;; sharing.