-
Couldn't load subscription status.
- Fork 13.9k
fix: Don't add diff symbol to unchanged lines #148001
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
Merged
bors
merged 1 commit into
rust-lang:master
from
Muscraft:fix-diff-symbol-unchanged-lines
Oct 23, 2025
Merged
fix: Don't add diff symbol to unchanged lines #148001
bors
merged 1 commit into
rust-lang:master
from
Muscraft:fix-diff-symbol-unchanged-lines
Oct 23, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
fmease
reviewed
Oct 22, 2025
da86f5e to
c7f014d
Compare
fmease
approved these changes
Oct 22, 2025
|
Thanks! @bors r+ rollup |
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Oct 22, 2025
…-lines, r=fmease fix: Don't add diff symbol to unchanged lines When rendering a "multi-line" suggestion with the [`Diff`](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L3078) format, `rustc` uses a [diff symbol](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L3017-L3022) for [any line that has a highlight part](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L2705-L2713). This includes highlight parts that are highlighting nothing, i.e., a span of `0..0`. This leads `rustc` to add a diff symbol unnecessarily to lines that have no changes and are not highlighted. This PR makes it so that `rustc` will not add a diff symbol to lines that contain no changes/highlights. Note: This PR is part of my ongoing effort to have `rustc` use `annotate-snippets` for rendering. This change will make it so that `rustc` and `annotate-snippets` will match in this case.
This was referenced Oct 22, 2025
bors
added a commit
that referenced
this pull request
Oct 23, 2025
Rollup of 4 pull requests Successful merges: - #115501 (Add new inherit_handles flag to CommandExt trait) - #146629 (std: reorganize the UNIX-internal `weak` module) - #147762 (feat(rustdoc): `--emit=depinfo` output to stdout via `-`) - #148001 (fix: Don't add diff symbol to unchanged lines) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Oct 23, 2025
Rollup merge of #148001 - Muscraft:fix-diff-symbol-unchanged-lines, r=fmease fix: Don't add diff symbol to unchanged lines When rendering a "multi-line" suggestion with the [`Diff`](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L3078) format, `rustc` uses a [diff symbol](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L3017-L3022) for [any line that has a highlight part](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L2705-L2713). This includes highlight parts that are highlighting nothing, i.e., a span of `0..0`. This leads `rustc` to add a diff symbol unnecessarily to lines that have no changes and are not highlighted. This PR makes it so that `rustc` will not add a diff symbol to lines that contain no changes/highlights. Note: This PR is part of my ongoing effort to have `rustc` use `annotate-snippets` for rendering. This change will make it so that `rustc` and `annotate-snippets` will match in this case.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 25, 2025
…szelmann chore: Update to the latest annotate-snippets This PR updates `annotate-snippets` to the latest version and updates the adapter code[^1] so that `AnnotateSnippetEmitter`'s output matches `HumanEmitter`'s output. If anyone would like to see the differences[^2] between `AnnotateSnippetEmitter` and `HumanEmitter`, [I have a branch](https://github.com/Muscraft/rust/tree/annotate-snippets-default-renderer) where `AnnotateSnippetEmitter` is used in place of `HumanEmitter`. [^1]: A lot of the adapter code changes are based on code for `HumanEmitter`. [^2]: Some of the test differences will go away when rust-lang#148001 and rust-lang#148004 are merged.
rust-timer
added a commit
that referenced
this pull request
Oct 25, 2025
Rollup merge of #148007 - Muscraft:annotate-snippets, r=jdonszelmann chore: Update to the latest annotate-snippets This PR updates `annotate-snippets` to the latest version and updates the adapter code[^1] so that `AnnotateSnippetEmitter`'s output matches `HumanEmitter`'s output. If anyone would like to see the differences[^2] between `AnnotateSnippetEmitter` and `HumanEmitter`, [I have a branch](https://github.com/Muscraft/rust/tree/annotate-snippets-default-renderer) where `AnnotateSnippetEmitter` is used in place of `HumanEmitter`. [^1]: A lot of the adapter code changes are based on code for `HumanEmitter`. [^2]: Some of the test differences will go away when #148001 and #148004 are merged.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-clippy
Relevant to the Clippy team.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When rendering a "multi-line" suggestion with the
Diffformat,rustcuses a diff symbol forany line that has a highlight part. This includes highlight parts that are highlighting nothing, i.e., a span of
0..0. This leadsrustcto add a diff symbol unnecessarily to lines that have no changes and are not highlighted. This PR makes it so thatrustcwill not add a diff symbol to lines that contain no changes/highlights.Note: This PR is part of my ongoing effort to have
rustcuseannotate-snippetsfor rendering. This change will make it so thatrustcandannotate-snippetswill match in this case.