Skip to content

fix: broken line:column indicator in errors - #6996

Open
eopb wants to merge 1 commit into
rust-lang:mainfrom
eopb:push-vkzonostxxvy
Open

fix: broken line:column indicator in errors#6996
eopb wants to merge 1 commit into
rust-lang:mainfrom
eopb:push-vkzonostxxvy

Conversation

@eopb

@eopb eopb commented Jul 29, 2026

Copy link
Copy Markdown

I noticed that I was seeing error messages from rustfmt that contained paths ending in :line:line:column. The example :3:3:20 can be found in the snapshot tests in this diff.

This appears to be related to how annotate_snippets automatically appends these indicators when annotations are set.

To fix this, I'm only appending :line when annotations are not set.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Jul 29, 2026
@eopb
eopb force-pushed the push-vkzonostxxvy branch 2 times, most recently from 585d843 to d4f6091 Compare July 29, 2026 14:11
I noticed that I was seeing error messages from rustfmt that contained paths ending in `:line:line:column`.
The example `:3:3:20` can be found in the snapshot tests in this diff.

This appears to be related to how `annotate_snippets` automatically appends these indicators when annotations are set.

To fix this, I'm only appending `:line` when annotations are not set.
@eopb
eopb force-pushed the push-vkzonostxxvy branch from d4f6091 to 475f85c Compare July 29, 2026 14:11
@ytmimi ytmimi self-assigned this Jul 29, 2026

@ytmimi ytmimi 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.

Could you please help me better understand what's going on. I'm not sure I'm fully following your comment about zero width spans.

View changes since this review

Comment on lines 2 to 8
source: src/test/mod.rs
---
error[internal]: line formatted, but exceeded maximum width (maximum: 100 (see `max_width` option), found: 109)
--> tests/warning/source/line_overflow.rs:1:1:101
--> tests/warning/source/line_overflow.rs:1:101
|
1 | fn this_function_name_is_intentionally_long_enough_to_exceed_the_default_one_hundred_character_maximum_width(
| ^^^^^^^^^

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 you help better understand where these annotations are getting added by annotate_snippets like you mention in the PR description. This doesn't seem like a zero width span like you mention in your comment in src/format_report_formatter.rs.

@rustbot rustbot added S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels Aug 1, 2026
@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants