File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -3137,6 +3137,40 @@ impl Two<'a> {
3137
3137
(let ((default-directory test-dir))
3138
3138
(should (equal (expand-file-name (rust-buffer-project)) manifest-file))))))
3139
3139
3140
+ (ert-deftest compilation-regexp-dashes ()
3141
+ (with-temp-buffer
3142
+ ; ; should match
3143
+ (insert " error found a -> b\n --> file1.rs:12:34\n\n " )
3144
+ (insert " error[E1234]: found a -> b\n --> file2.rs:12:34\n\n " )
3145
+ (insert " warning found a -> b\n --> file3.rs:12:34\n\n " )
3146
+ ; ; should not match
3147
+ (insert " werror found a -> b\n --> file4.rs:12:34\n\n " )
3148
+
3149
+ (goto-char (point-min ))
3150
+ (let ((matches nil ))
3151
+ (while (re-search-forward (car rustc-compilation-regexps) nil t )
3152
+ (push
3153
+ (mapcar (lambda (r )
3154
+ (let ((match-pos
3155
+ (nth (cdr r) rustc-compilation-regexps)))
3156
+ (if (eq :is-warning (car r))
3157
+ (compilation-face match-pos)
3158
+ (match-string match-pos))))
3159
+ ; ; see compilation-error-regexp-alist
3160
+ '((:file . 1 )
3161
+ (:line . 2 )
3162
+ (:column . 3 )
3163
+ (:is-warning . 4 )
3164
+ (:mouse-highlight . 5 )))
3165
+ matches))
3166
+ (setq matches (reverse matches))
3167
+
3168
+ (should (equal
3169
+ '((" file1.rs" " 12" " 34" compilation-error " file1.rs:12:34" )
3170
+ (" file2.rs" " 12" " 34" compilation-error " file2.rs:12:34" )
3171
+ (" file3.rs" " 12" " 34" compilation-warning " file3.rs:12:34" ))
3172
+ matches)))))
3173
+
3140
3174
; ; If electric-pair-mode is available, load it and run the tests that use it. If not,
3141
3175
; ; no error--the tests will be skipped.
3142
3176
(require 'elec-pair nil t )
Original file line number Diff line number Diff line change @@ -1640,8 +1640,8 @@ Return the created process."
1640
1640
(defvar rustc-compilation-regexps
1641
1641
(let ((file " \\ ([^\n ]+\\ )" )
1642
1642
(start-line " \\ ([0-9]+\\ )" )
1643
- (start-col " \\ ([0-9]+\\ )" ))
1644
- (let ((re (concat " ^\\ (?:error\\ |\\ (warning\\ )\\ )[^-]+ --> \\ (" file " :" start-line " :" start-col " \\ )" )))
1643
+ (start-col " \\ ([0-9]+\\ )" ))
1644
+ (let ((re (concat " ^\\ (?:error\\ |\\ (warning\\ )\\ )[^\0 ]+? --> \\ (" file " :" start-line " :" start-col " \\ )" )))
1645
1645
(cons re '(3 4 5 (1 ) 2 ))))
1646
1646
" Specifications for matching errors in rustc invocations.
1647
1647
See `compilation-error-regexp-alist' for help on their format." )
You can’t perform that action at this time.
0 commit comments