Skip to content

Make -Ztrack-diagnostics emit like a note #143286

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Jul 1, 2025

#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note

As discussed on the Zulip thread above, I want to make -Ztrack-diagnostics emit like a note. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, even in the middle of a snippet, seems like something that should be changed. Turning it into a note seems like the best choice, as it would align it with the rest of the output, and note is already used for somewhat similar things, like seeing why a lint was fired.


Note: turning -Ztrack-diagnostics into a note will also make annotate-snippets API a bit cleaner

@rustbot
Copy link
Collaborator

rustbot commented Jul 1, 2025

r? @WaffleLapkin

rustbot has assigned @WaffleLapkin.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 1, 2025
@petrochenkov
Copy link
Contributor

It's now emitted as a note into the json output as well, right?

Could you then migrate tests using -Ztrack-diagnostics from //@ error-pattern: created at to //~ NOTE created at?
All of them are either in tests\ui\track-diagnostics or in tests\rustdoc-ui\track-diagnostics.rs.

//@ dont-require-annotations: NOTE can be used to keep the NOTE annotations non-viral, if necessary.

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from b528aba to dc4877b Compare July 1, 2025 19:22
@Muscraft
Copy link
Member Author

Muscraft commented Jul 1, 2025

It's now emitted as a note into the json output as well, right?

No, I only made it so that it gets rendered like a note in HumanEmitter

Could you then migrate tests using -Ztrack-diagnostics from //@ error-pattern: created at to //~ NOTE created at?
All of them are either in tests\ui\track-diagnostics or in tests\rustdoc-ui\track-diagnostics.rs.

//@ dont-require-annotations: NOTE can be used to keep the NOTE annotations non-viral, if necessary.

Since this isn't changing the json, would you still like me to do this?

@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

Since this isn't changing the json, would you still like me to do this?

Compiletest is working on the json output, so //~ NOTE won't work if the output is not there.
Ideally this would be actually outputted in some structured form, and not just into the rendered text.

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from dc4877b to e47cd86 Compare July 1, 2025 22:39
@rustbot
Copy link
Collaborator

rustbot commented Jul 1, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from e47cd86 to 6d3ffe1 Compare July 1, 2025 22:47
@Muscraft
Copy link
Member Author

Muscraft commented Jul 1, 2025

Ideally this would be actually outputted in some structured form, and not just into the rendered text.

I don't know how I would add it to the JSON output, but if I need to, I'll see what I can figure out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
5 participants