Skip to content

Commit e04e485

Browse files
authored
rustc-compilation-regexps: handle note case as compilation-info.
1 parent e8345f6 commit e04e485

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

rust-mode-tests.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,7 +3040,7 @@ type Foo<T> where T: Copy = Box<T>;
30403040
'(7 9))))
30413041

30423042

3043-
(ert-deftest redo-syntax-after-change-far-from-point ()
3043+
(ert-deftest redo-syntax-after-change-far-from-point ()
30443044
(let*
30453045
((tmp-file-name (make-temp-file "rust-mdoe-test-issue104"))
30463046
(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> {
32313231
(insert "error found a -> b\n --> file1.rs:12:34\n\n")
32323232
(insert "error[E1234]: found a -> b\n --> file2.rs:12:34\n\n")
32333233
(insert "warning found a -> b\n --> file3.rs:12:34\n\n")
3234+
(insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n")
32343235
;; should not match
3235-
(insert "werror found a -> b\n --> file4.rs:12:34\n\n")
3236+
(insert "werror found a -> b\n --> no_match.rs:12:34\n\n")
32363237

32373238
(goto-char (point-min))
32383239
(let ((matches nil))
@@ -3241,22 +3242,23 @@ impl Two<'a> {
32413242
(mapcar (lambda (r)
32423243
(let ((match-pos
32433244
(nth (cdr r) rustc-compilation-regexps)))
3244-
(if (eq :is-warning (car r))
3245+
(if (eq :type (car r))
32453246
(compilation-face match-pos)
32463247
(match-string match-pos))))
32473248
;; see compilation-error-regexp-alist
32483249
'((:file . 1)
32493250
(:line . 2)
32503251
(:column . 3)
3251-
(:is-warning . 4)
3252+
(:type . 4)
32523253
(:mouse-highlight . 5)))
32533254
matches))
32543255
(setq matches (reverse matches))
32553256

32563257
(should (equal
32573258
'(("file1.rs" "12" "34" compilation-error "file1.rs:12:34")
32583259
("file2.rs" "12" "34" compilation-error "file2.rs:12:34")
3259-
("file3.rs" "12" "34" compilation-warning "file3.rs:12:34"))
3260+
("file3.rs" "12" "34" compilation-warning "file3.rs:12:34")
3261+
("file4.rs" "12" "34" compilation-info "file4.rs:12:34"))
32603262
matches)))))
32613263

32623264
;; If electric-pair-mode is available, load it and run the tests that use it. If not,

rust-mode.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,9 +1831,9 @@ Return the created process."
18311831
(let ((file "\\([^\n]+\\)")
18321832
(start-line "\\([0-9]+\\)")
18331833
(start-col "\\([0-9]+\\)"))
1834-
(let ((re (concat "^\\(?:error\\|\\(warning\\)\\)[^\0]+?--> \\("
1834+
(let ((re (concat "^\\(?:error\\|\\(warning\\)\\|\\(note\\)\\)[^\0]+?--> \\("
18351835
file ":" start-line ":" start-col "\\)")))
1836-
(cons re '(3 4 5 (1) 2))))
1836+
(cons re '(4 5 6 (1 . 2) 3))))
18371837
"Specifications for matching errors in rustc invocations.
18381838
See `compilation-error-regexp-alist' for help on their format.")
18391839

0 commit comments

Comments
 (0)