summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristoffer Grönlund <krig@koru.se>2015-05-18 10:34:10 +0200
committerKristoffer Grönlund <krig@koru.se>2015-05-18 10:34:10 +0200
commitf17e11ac890bcc8b91cf79e9b4dda66d5d9b97d6 (patch)
tree08e959596389a54d49b443cfa84c5401dbd57c2b
parent8a8bd588e17d469aab211868efe31f059ae7df24 (diff)
downloadrust-mode-f17e11ac890bcc8b91cf79e9b4dda66d5d9b97d6.tar.gz
Match panics during build as compilation warnings
Enables using `cargo test` as the compilation command in emacs, and adds test failures as compilation warnings.
-rw-r--r--rust-mode.el12
1 files changed, 11 insertions, 1 deletions
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.