summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorNathan Moreau <nathan.moreau@m4x.org>2020-06-18 15:14:48 +0200
committerGitHub <noreply@github.com>2020-06-18 15:14:48 +0200
commit00177f542976601d7f114fed82caaa3daad7b177 (patch)
tree81159ee736e56ce508f528b80f91e7769b9e3cef /rust-mode.el
parent9eb2c632e32e9979a1694c1e62961d7ad66e8f4a (diff)
downloadrust-mode-00177f542976601d7f114fed82caaa3daad7b177.tar.gz
compile-mode integration: add link to code references. (#391)
This allows to jump to code references such as lines 82 and 132 in the following snippet error message. error[E0061]: this function takes 1 parameter but 2 parameters were supplied --> file6.rs:132:34 | 82 | fn duration_ms_since(time: &Option<SystemTime>) -> u128 { | ------------------------------------------------------- defined here ... 132 | self.total_time_ms = duration_ms_since(&self.program_start, 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust-mode.el b/rust-mode.el
index d5e0b93..9711a79 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1947,6 +1947,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-refs-compilation-regexps
+ (let ((re "^\\([0-9]+\\)[[:space:]]*|"))
+ (cons re '(nil 1 nil 0 1)))
+ "Specifications for matching code references 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
@@ -1978,6 +1984,9 @@ the compilation window until the top of the error is visible."
(eval-after-load 'compile
'(progn
(add-to-list 'compilation-error-regexp-alist-alist
+ (cons 'rustc-refs rustc-refs-compilation-regexps))
+ (add-to-list 'compilation-error-regexp-alist 'rustc-refs)
+ (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-alist