@@ -1574,31 +1574,22 @@ 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
1581- (let ((file " \\ ([^\n ]+\\ )" )
1582- (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 )))))
1591- " Specifications for matching errors in rustc invocations.
1592- See `compilation-error-regexp-alist' for help on their format." )
1593-
1594- (defvar rustc-new-compilation-regexps
15951578 (let ((file " \\ ([^\n ]+\\ )" )
15961579 (start-line " \\ ([0-9]+\\ )" )
15971580 (start-col " \\ ([0-9]+\\ )" ))
15981581 (let ((re (concat " ^ *--> " file " :" start-line " :" start-col ; --> 1:2:3
15991582 )))
16001583 (cons re '(1 2 3 ))))
1601- " Specifications for matching errors in rustc invocations (new style).
1584+ " Specifications for matching errors in rustc invocations.
1585+ See `compilation-error-regexp-alist' for help on their format." )
1586+
1587+ (defvar rustc-colon-compilation-regexps
1588+ (let ((file " \\ ([^\n ]+\\ )" ))
1589+ (let ((re (concat " ^ *::: " file ; ::: foo/bar.rs
1590+ )))
1591+ (cons re '(1 ))))
1592+ " Specifications for matching `:::` hints in rustc invocations.
16021593See `compilation-error-regexp-alist' for help on their format." )
16031594
16041595; ; Match test run failures and panics during compilation as
@@ -1630,16 +1621,16 @@ See `compilation-error-regexp-alist' for help on their format.")
16301621
16311622(eval-after-load 'compile
16321623 '(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 )
16371624 (add-to-list 'compilation-error-regexp-alist-alist
16381625 (cons 'rustc rustc-compilation-regexps))
16391626 (add-to-list 'compilation-error-regexp-alist 'rustc )
1627+ (add-to-list 'compilation-error-regexp-alist-alist
1628+ (cons 'rustc-colon rustc-colon-compilation-regexps))
1629+ (add-to-list 'compilation-error-regexp-alist 'rustc-colon )
16401630 (add-to-list 'compilation-error-regexp-alist-alist
16411631 (cons 'cargo cargo-compilation-regexps))
1642- (add-to-list 'compilation-error-regexp-alist 'cargo )))
1632+ (add-to-list 'compilation-error-regexp-alist 'cargo )
1633+ (add-hook 'next-error-hook 'rustc-scroll-down-after-next-error )))
16431634
16441635; ;; Functions to submit (parts of) buffers to the rust playpen, for
16451636; ;; sharing.
0 commit comments