Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't duplicate line numbers when annotating internal errors #5506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ytmimi
Copy link
Contributor

@ytmimi ytmimi commented Aug 17, 2022

Closes #5463

The annotate_snippets crate adds line number and column info to the output, so we don't need to append the line number to the origin we pass to annotate_snippets::snippet::Snippet.

Previously, internal errors would be output with the line number twice. See how 478 is duplicated in the example below.

error[internal]: line formatted, but exceeded maximum width
   --> /path/to/file.rs:478:478:101

Now the line number is not duplicated.

error[internal]: line formatted, but exceeded maximum width
   --> /path/to/file.rs:478:101

@calebcartwright
Copy link
Member

calebcartwright commented Dec 9, 2023

I didn't realize the age of this one when we were discussing in Zulip 😅 In my head I was thinking this was something new and I felt like we'd had a couple prior PRs (even one on the 2x branch) that were attempting to address this, so maybe there's not any duplicative/overlapping PRs after all.

So long as everything "looks right" both when formatting an actual file as well as when formatting stdin, this LGTM and after a rebase i'd be happy to merge

Closes 5463

The `annotate_snippets` crate adds line number and column info to the
output, so we don't need to append the line number to the `origin`.

Previously, internal errors would be output with the line number twice.
See how 478 is duplicated in the example below.

```
error[internal]: line formatted, but exceeded maximum width
   --> /path/to/file.rs:478:478:101
```

Now the line number is not duplicated.

```
error[internal]: line formatted, but exceeded maximum width
   --> /path/to/file.rs:478:101
```
@ytmimi
Copy link
Contributor Author

ytmimi commented Dec 9, 2023

@calebcartwright I just rebased 😁

@ytmimi
Copy link
Contributor Author

ytmimi commented Dec 9, 2023

Not sure if you've seen #5971, but I think the changes there are fairly similar. Probably not urgent, but wanted to mention it.

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

Successfully merging this pull request may close these issues.

Incorrect path printed on error
2 participants