diff options
| author | Nathan Moreau <nathan.moreau@m4x.org> | 2020-04-12 17:42:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-12 17:42:15 +0200 |
| commit | e04e485b9f74b0fcb52816fb01845af083213bdf (patch) | |
| tree | 1b8a4d5c457d3c99e41665e048129ca2acd1eed7 | |
| parent | e8345f6aa7f1e33a5bdc8e64d092b32c8a856239 (diff) | |
| download | rust-mode-e04e485b9f74b0fcb52816fb01845af083213bdf.tar.gz | |
rustc-compilation-regexps: handle `note` case as compilation-info.
| -rw-r--r-- | rust-mode-tests.el | 12 | ||||
| -rw-r--r-- | rust-mode.el | 4 |
2 files changed, 9 insertions, 7 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index b680548..d0fb27a 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -3040,7 +3040,7 @@ type Foo<T> where T: Copy = Box<T>; '(7 9)))) -(ert-deftest redo-syntax-after-change-far-from-point () +(ert-deftest redo-syntax-after-change-far-from-point () (let* ((tmp-file-name (make-temp-file "rust-mdoe-test-issue104")) (base-contents (apply 'concat (append '("fn foo() {\n\n}\n") (make-list 500 "// More stuff...\n") '("fn bar() {\n\n}\n"))))) @@ -3231,8 +3231,9 @@ impl Two<'a> { (insert "error found a -> b\n --> file1.rs:12:34\n\n") (insert "error[E1234]: found a -> b\n --> file2.rs:12:34\n\n") (insert "warning found a -> b\n --> file3.rs:12:34\n\n") + (insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n") ;; should not match - (insert "werror found a -> b\n --> file4.rs:12:34\n\n") + (insert "werror found a -> b\n --> no_match.rs:12:34\n\n") (goto-char (point-min)) (let ((matches nil)) @@ -3241,14 +3242,14 @@ impl Two<'a> { (mapcar (lambda (r) (let ((match-pos (nth (cdr r) rustc-compilation-regexps))) - (if (eq :is-warning (car r)) + (if (eq :type (car r)) (compilation-face match-pos) (match-string match-pos)))) ;; see compilation-error-regexp-alist '((:file . 1) (:line . 2) (:column . 3) - (:is-warning . 4) + (:type . 4) (:mouse-highlight . 5))) matches)) (setq matches (reverse matches)) @@ -3256,7 +3257,8 @@ impl Two<'a> { (should (equal '(("file1.rs" "12" "34" compilation-error "file1.rs:12:34") ("file2.rs" "12" "34" compilation-error "file2.rs:12:34") - ("file3.rs" "12" "34" compilation-warning "file3.rs:12:34")) + ("file3.rs" "12" "34" compilation-warning "file3.rs:12:34") + ("file4.rs" "12" "34" compilation-info "file4.rs:12:34")) matches))))) ;; If electric-pair-mode is available, load it and run the tests that use it. If not, diff --git a/rust-mode.el b/rust-mode.el index e7ef1ef..f91d5ff 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1831,9 +1831,9 @@ Return the created process." (let ((file "\\([^\n]+\\)") (start-line "\\([0-9]+\\)") (start-col "\\([0-9]+\\)")) - (let ((re (concat "^\\(?:error\\|\\(warning\\)\\)[^\0]+?--> \\(" + (let ((re (concat "^\\(?:error\\|\\(warning\\)\\|\\(note\\)\\)[^\0]+?--> \\(" file ":" start-line ":" start-col "\\)"))) - (cons re '(3 4 5 (1) 2)))) + (cons re '(4 5 6 (1 . 2) 3)))) "Specifications for matching errors in rustc invocations. See `compilation-error-regexp-alist' for help on their format.") |
