Support Rust compiler messages in compile mode (bug#70794).

* etc/compilation.txt: Add examples of Rust compiler error, warning and
note messages.
* lisp/progmodes/compile.el
(compilation-error-regexp-alist-alist): Add Rust regexps for error,
warning and note messages.
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data): Add new test cases.
(compile-test-error-regexps): Increase expected errors.
This commit is contained in:
Vincenzo Pupillo 2025-05-19 22:31:41 +02:00 committed by Mattias Engdegård
parent 0b2ba13c97
commit 676f12c65f
3 changed files with 36 additions and 3 deletions

View file

@ -487,6 +487,17 @@ symbol: php
Parse error: parse error, unexpected $ in main.php on line 59
Fatal error: Call to undefined function: mysql_pconnect() in db.inc on line 66
* Rust
symbol: rust
error[E0277]: `Foo` is not an iterator
--> src/main.rs:4:16
warning: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
--> lint_example.rs:11:13
note: required by a bound in `Trait`
--> src/auxiliary/trait-debuginfo.rs:23:18
* Ruby
symbol: ruby

View file

@ -565,6 +565,19 @@ during global destruction\\.$\\)" 1 2)
"\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)"
2 3 nil nil)
(rust
,(rx bol (or (group-n 1 "error") (group-n 2 "warning") (group-n 3 "note"))
(? "[" (+ (in "A-Z" "0-9")) "]") ":" (* nonl)
"\n" (+ " ") "-->"
" " (group-n 4 (+ nonl)) ; file
":" (group-n 5 (+ (in "0-9"))) ; line
":" (group-n 6 (+ (in "0-9")))) ; column
4 5 6 (2 . 3)
nil
(1 compilation-error-face)
(2 compilation-warning-face)
(3 compilation-info-face))
(rxp
"^\\(?:Error\\|Warnin\\(g\\)\\):.*\n.* line \\([0-9]+\\) char\
\\([0-9]+\\) of file://\\(.+\\)"

View file

@ -372,6 +372,15 @@
1 nil 59 "main.php")
(php "Fatal error: Call to undefined function: mysql_pconnect() in db.inc on line 66"
1 nil 66 "db.inc")
;; rust
(rust
"error[E0277]: `Foo` is not an iterator\n --> src/main.rs:4:16"
1 16 4 "src/main.rs")
(rust "warning: borrow of packed field is unsafe and requires unsafe function or block (error E0133)\n --> lint_example.rs:11:13"
1 13 11 "lint_example.rs")
(rust
"note: required by a bound in `Trait`\n --> src/auxiliary/trait-debuginfo.rs:23:18"
1 18 23 "src/auxiliary/trait-debuginfo.rs")
;; ruby (uses gnu)
(gnu "plain-exception.rb:7:in `fun': unhandled exception"
1 nil 7 "plain-exception.rb")
@ -538,9 +547,9 @@ The test data is in `compile-tests--test-regexps-data'."
1 15 5 "alpha.c")))
(compile--test-error-line test))
(should (eq compilation-num-errors-found 107))
(should (eq compilation-num-warnings-found 36))
(should (eq compilation-num-infos-found 35)))))
(should (eq compilation-num-errors-found 108))
(should (eq compilation-num-warnings-found 37))
(should (eq compilation-num-infos-found 36)))))
(ert-deftest compile-test-grep-regexps ()
"Test the `grep-regexp-alist' regexps.