Skip to content

Commit 42c98bb

Browse files
authored
Merge pull request #263 from nikomatsakis/tweak-compilation-regexp
remove old-style compilation regex; support `:::` regex
2 parents cc2435b + 31b8453 commit 42c98bb

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

rust-mode.el

+12-19
Original file line numberDiff line numberDiff line change
@@ -1574,31 +1574,24 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
15741574
(defun rust--before-save-hook ()
15751575
(when rust-format-on-save (rust-format-buffer)))
15761576

1577-
;; Issue #6887: Rather than inheriting the 'gnu compilation error
1578-
;; regexp (which is broken on a few edge cases), add our own 'rust
1579-
;; compilation error regexp and use it instead.
15801577
(defvar rustc-compilation-regexps
15811578
(let ((file "\\([^\n]+\\)")
15821579
(start-line "\\([0-9]+\\)")
1583-
(start-col "\\([0-9]+\\)")
1584-
(end-line "\\([0-9]+\\)")
1585-
(end-col "\\([0-9]+\\)")
1586-
(msg-type "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\|\\([Nn]ote\\|[Hh]elp\\)\\)"))
1587-
(let ((re (concat "^" file ":" start-line ":" start-col
1588-
": " end-line ":" end-col
1589-
" " msg-type ":")))
1590-
(cons re '(1 (2 . 4) (3 . 5) (6 . 7)))))
1580+
(start-col "\\([0-9]+\\)"))
1581+
(let ((re (concat "^ *--> " file ":" start-line ":" start-col ; --> 1:2:3
1582+
)))
1583+
(cons re '(1 2 3))))
15911584
"Specifications for matching errors in rustc invocations.
15921585
See `compilation-error-regexp-alist' for help on their format.")
15931586

1594-
(defvar rustc-new-compilation-regexps
1587+
(defvar rustc-colon-compilation-regexps
15951588
(let ((file "\\([^\n]+\\)")
15961589
(start-line "\\([0-9]+\\)")
15971590
(start-col "\\([0-9]+\\)"))
1598-
(let ((re (concat "^ *--> " file ":" start-line ":" start-col ; --> 1:2:3
1591+
(let ((re (concat "^ *::: " file ":" start-line ":" start-col ; ::: foo/bar.rs
15991592
)))
16001593
(cons re '(1 2 3))))
1601-
"Specifications for matching errors in rustc invocations (new style).
1594+
"Specifications for matching `:::` hints in rustc invocations.
16021595
See `compilation-error-regexp-alist' for help on their format.")
16031596

16041597
;; Match test run failures and panics during compilation as
@@ -1630,16 +1623,16 @@ See `compilation-error-regexp-alist' for help on their format.")
16301623

16311624
(eval-after-load 'compile
16321625
'(progn
1633-
(add-to-list 'compilation-error-regexp-alist-alist
1634-
(cons 'rustc-new rustc-new-compilation-regexps))
1635-
(add-to-list 'compilation-error-regexp-alist 'rustc-new)
1636-
(add-hook 'next-error-hook 'rustc-scroll-down-after-next-error)
16371626
(add-to-list 'compilation-error-regexp-alist-alist
16381627
(cons 'rustc rustc-compilation-regexps))
16391628
(add-to-list 'compilation-error-regexp-alist 'rustc)
1629+
(add-to-list 'compilation-error-regexp-alist-alist
1630+
(cons 'rustc-colon rustc-colon-compilation-regexps))
1631+
(add-to-list 'compilation-error-regexp-alist 'rustc-colon)
16401632
(add-to-list 'compilation-error-regexp-alist-alist
16411633
(cons 'cargo cargo-compilation-regexps))
1642-
(add-to-list 'compilation-error-regexp-alist 'cargo)))
1634+
(add-to-list 'compilation-error-regexp-alist 'cargo)
1635+
(add-hook 'next-error-hook 'rustc-scroll-down-after-next-error)))
16431636

16441637
;;; Functions to submit (parts of) buffers to the rust playpen, for
16451638
;;; sharing.

0 commit comments

Comments
 (0)