Skip to content

fix: match rustc-unicode locations in the rustc problem matcher - #23598

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
Xander-AJ:fix/problem-matcher-rustc-unicode
Nov 6, 2026
Merged

ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
Xander-AJ:fix/problem-matcher-rustc-unicode

Conversation

@Xander-AJ

@Xander-AJ Xander-AJ commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #23301

With rustc-unicode enabled, rustc prints the location of a diagnostic as ╭▸ src/main.rs:2:5 instead of --> src/main.rs:2:5. The location line of the $rustc problem pattern only skipped whitespace, -, > and = before the path, so ╭▸ became part of the file name and VS Code couldn't match the diagnostic to the open file.

I added the unicode location markers to that character class. annotate-snippets (which rustc uses for unicode output) prints ╭▸ for the first location, ─▸ when the location stands alone and ├▸ for later ones, so all three are covered. The header pattern didn't need changing because the error[EXXXX]: ... line is the same in both formats.

Tested by loading the patterns from package.json into new RegExp and running them on ASCII and unicode samples from rustc's .unicode.stderr UI tests (e.g. tests/ui/error-emitter/close_window.unicode.stderr). ASCII samples parse as before; unicode ones now give the right file, line and column.

AI disclosure: I used an AI assistant to help find the rustc output format and write the regex change. I reviewed the change and can explain it.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2026
@rustbot

This comment has been minimized.

With `-Zunstable-options --error-format=human-unicode` (cargo's `rustc-unicode`), rustc
prints the primary location as `╭▸ src/main.rs:2:5` (or `─▸`/`├▸`) instead of
`--> src/main.rs:2:5`. The `$rustc` problem pattern only skipped `-`, `>`, `=` and
whitespace before the path, so the box-drawing prefix ended up in the file name and
diagnostics could not be mapped back to the source file.

Fixes rust-lang#23301
@Xander-AJ
Xander-AJ force-pushed the fix/problem-matcher-rustc-unicode branch from 67c234b to 0d3abd8 Compare November 2, 2026 11:12

@ChayimFriedman2 ChayimFriedman2 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't test this properly unfortunately...

Thanks!

View changes since this review

@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Nov 6, 2026
Merged via the queue into rust-lang:master with commit f4ebbdc Nov 6, 2026
21 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error messages disappear when rustc-unicode is enabled

3 participants