Skip to content

Commit c0aadfd

Browse files
committed
auto merge of #8747 : pnkfelix/rust/fsk-issue6887-fix-emacs-compilation-regexp, r=graydon
Fix #6887
2 parents af99b8d + 9d8897b commit c0aadfd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: src/etc/emacs/rust-mode.el

+23
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,27 @@ The initializer is `DEFAULT-TAB-WIDTH'.")
225225

226226
(provide 'rust-mode)
227227

228+
;; Issue #6887: Rather than inheriting the 'gnu compilation error
229+
;; regexp (which is broken on a few edge cases), add our own 'rust
230+
;; compilation error regexp and use it instead.
231+
(defvar rustc-compilation-regexps
232+
(let ((file "^\\([^\n]+\\)")
233+
(start-line "\\([0-9]+\\)")
234+
(start-col "\\([0-9]+\\)")
235+
(end-line "\\([0-9]+\\)")
236+
(end-col "\\([0-9]+\\)")
237+
(error-or-warning "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\)"))
238+
(let ((re (concat "^" file ":" start-line ":" start-col
239+
": " end-line ":" end-col
240+
" \\(?:[Ee]rror\\|\\([Ww]arning\\)\\):")))
241+
(cons re '(1 (2 . 4) (3 . 5) (6)))))
242+
"Specifications for matching errors in rustc invocations.
243+
See `compilation-error-regexp-alist for help on their format.")
244+
245+
(eval-after-load 'compile
246+
'(progn
247+
(add-to-list 'compilation-error-regexp-alist-alist
248+
(cons 'rustc rustc-compilation-regexps))
249+
(add-to-list 'compilation-error-regexp-alist 'rustc)))
250+
228251
;;; rust-mode.el ends here

0 commit comments

Comments
 (0)