Skip to content

Add support for annotate-snippets's no-graphics output format - #165708

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Muscraft:support-no-graphics
Nov 12, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Muscraft:support-no-graphics

Conversation

@Muscraft

@Muscraft Muscraft commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

View all comments

Tracking Issue: #165164
MCP: rust-lang/compiler-team#1045

This PR adds the initial support for annotate-snippets's no-graphics output format. The no-graphics output format doesn't show source snippets or use any graphical decorations and is primarily designed for Text-To-Speech and Braille displays. The goal at this time is to get no-graphics in front of users so we can iterate on and improve the output.


🤖 LLM involvement: I used an LLM to review the commits before submitting

r? @estebank

@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs 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 Nov 9, 2026
@rust-log-analyzer

This comment has been minimized.

@Muscraft
Muscraft force-pushed the support-no-graphics branch from bd12853 to 791e562 Compare November 9, 2026 20:05
@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

@rustbot

This comment has been minimized.

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

I'm leaning towards r+, but am slightly concerned by this new flag option being insta-stable. Could we add a check for -Zunstable-options being present before allowing the output? It could even still allow changing the rendering (even on stable), as long as an error is always emitted complaining that the feature is unstable. That way people can already start using it, while giving no stability guarantees because having the flag always enabled would cause it to never permit a compile to succeed.

View changes since this review

@@ -33,6 +33,7 @@ use crate::{
/// Describes the way the content of the `rendered` field of the json output is generated
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct HumanReadableErrorType {

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.

Non-blocker. We should be moving towards an enum, I think.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree that we should move to an enum, and I tried to do so, but I ran into issues discerning what should be variants vs. options e.g., is short its own rendering format (variant), or is it an option on graphics/no-graphics?

@estebank estebank Nov 9, 2026 •

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.

I think that (at least eventually) we likely want to fully enumerate all of the cases (so short would be its own thing). The only one that is orthogonal is color, IMO. To be clear, I don't mind not doing that in this PR!

//! Check that compile errors are formatted in the "no-graphics" style
//! when `--error-format=human-no-graphics` is used.
//@ compile-flags: --error-format=human-no-graphics

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.

Is there no gate for -Znightly-features for --error-format=human-no-graphics, or for that matter the previously existing --error-format=human-unicode? I thought we hadn't stabilized that last one yet (but I can see on stable rustc that it works).

The only reason I am concerned about it is that I might want to have a round of discussion on what the flag name should be long term. I am personally biased towards this new mode being called --error-format=text-only or --error-format=no-graphics.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is there no gate for -Znightly-features for --error-format=human-no-graphics, or for that matter the previously existing --error-format=human-unicode?

-Zunstable-options isn't required in UI tests since RUSTC_BOOTSTRAP=1 is set for all UI tests. The docs I linked to say that act-as-stable can be used in UI tests to verify stable-only behavior; I can add a test that uses it if you want.

I thought we hadn't stabilized that last one yet (but I can see on stable rustc that it works).

Maybe I did something wrong, but using --error-format=human-unicode on +stable gives me an error, but not on nightly:

❯ echo 'fn main(){let x;}' | rustc +stable - --error-format=human-unicode
error: `--error-format=human-unicode` is unstable
❯ echo 'fn main(){let x;}' | rustc +nightly - --error-format=human-unicode
error[E0282]: type annotations needed
  ╭▸ <anon>:1:15
  │
1 │ fn main(){let x;}
  │               ━
  ╰╴
help: consider giving `x` an explicit type
  ╭╴
1 │ fn main(){let x: /* Type */;}
  ╰╴               ++++++++++++

error: aborting due to 1 previous error

The only reason I am concerned about it is that I might want to have a round of discussion on what the flag name should be long term. I am personally biased towards this new mode being called --error-format=text-only or --error-format=no-graphics.

I personally prefer --error-format=no-graphics and would be happy to switch to it if it seems like the right thing to do. I only went with --error-format=human-no-graphics to match the existing naming convention(s).

@estebank estebank Nov 9, 2026 •

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 we add two more svg tests showing the interaction of color and no-color with the new diagnostic render?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can add an SVG test for color, but no-color always uses .stderr, as far as I can tell. The only way I could find to get no-color to use an SVG was to also enable -Zterminal-urls=yes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added a test that shows color (svg), no-color (stderr), and terminal-urls (SVG, with color). Let me know if they are what you were looking for

@Muscraft
Muscraft force-pushed the support-no-graphics branch from 791e562 to c34bdf9 Compare November 10, 2026 01:31
@rustbot

This comment has been minimized.

@estebank

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c34bdf9 has been approved by estebank

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 10, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 10, 2026
…tebank

Add support for `annotate-snippets`'s `no-graphics` output format

Tracking Issue: rust-lang#165164
MCP: rust-lang/compiler-team#1045

This PR adds the initial support for `annotate-snippets`'s [`no-graphics` output format](https://docs.rs/annotate-snippets/latest/annotate_snippets/struct.Renderer.html#method.no_graphics). The `no-graphics` output format doesn't show source snippets or use any graphical decorations and is primarily designed for Text-To-Speech and Braille displays. The goal at this time is to get `no-graphics` in front of users so we can iterate on and improve the output.

---

🤖 LLM involvement: I used an LLM to review the commits before submitting

r? @estebank
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 10, 2026
…tebank

Add support for `annotate-snippets`'s `no-graphics` output format

Tracking Issue: rust-lang#165164
MCP: rust-lang/compiler-team#1045

This PR adds the initial support for `annotate-snippets`'s [`no-graphics` output format](https://docs.rs/annotate-snippets/latest/annotate_snippets/struct.Renderer.html#method.no_graphics). The `no-graphics` output format doesn't show source snippets or use any graphical decorations and is primarily designed for Text-To-Speech and Braille displays. The goal at this time is to get `no-graphics` in front of users so we can iterate on and improve the output.

---

🤖 LLM involvement: I used an LLM to review the commits before submitting

r? @estebank
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #165742 (comment)

Probably this PR?
@bors try jobs=test-x86_64-gnu-aux

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 10, 2026
@rust-bors

rust-bors Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#165742), which was unapproved.

View changes since this unapproval

rust-bors Bot pushed a commit that referenced this pull request Nov 10, 2026
Add support for `annotate-snippets`'s `no-graphics` output format


try-job: test-x86_64-gnu-aux
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 5220576 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Muscraft
Muscraft force-pushed the support-no-graphics branch from 796f4d7 to 36e5310 Compare November 12, 2026 01:36
@rustbot

rustbot commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 12, 2026
@Muscraft

Copy link
Copy Markdown
Member Author

The failures were caused by two things:

  1. One of Cargo's tests depended on a rendered error message from Rust that was slightly modified by this PR
  2. When I added the new color tests, I forgot to add the .windows.svg for them

Note: annotate-snippets@0.12.18 was released since this PR was originally opened, so I went ahead and updated to it since this PR was already updating to 0.12.17. 0.12.18 removed the Windows-specific colors, making the colors consistent across OSes. This made the Windows-specific color tests (.windows.svg) redundant, so I removed them. I would be happy to split the update into its own PR if desired.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 12, 2026
@Muscraft
Muscraft force-pushed the support-no-graphics branch from 36e5310 to 6a4426f Compare November 12, 2026 01:39
@estebank

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6a4426f has been approved by estebank

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 12, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 12, 2026
@rust-bors

rust-bors Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: estebank
Duration: 3h 20m 37s
Pushing b4fe65c to main...

@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 6b05f82 (parent) -> b4fe65c (this PR)

Test differences

Show 16 test diffs

Stage 1

  • [ui] tests/ui/diagnostic-flags/error-format-human-no-graphics.rs: [missing] -> pass (J1)
  • [ui] tests/ui/error-emitter/no-graphics.rs#color: [missing] -> pass (J1)
  • [ui] tests/ui/error-emitter/no-graphics.rs#no-color: [missing] -> pass (J1)
  • [ui] tests/ui/error-emitter/no-graphics.rs#terminal-urls: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic-flags/error-format-human-no-graphics.rs: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/error-emitter/no-graphics.rs#color: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/error-emitter/no-graphics.rs#no-color: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/error-emitter/no-graphics.rs#terminal-urls: [missing] -> pass (J2)

Stage 2

  • [ui] tests/ui/diagnostic-flags/error-format-human-no-graphics.rs: [missing] -> pass (J0)
  • [ui] tests/ui/error-emitter/no-graphics.rs#color: [missing] -> pass (J0)
  • [ui] tests/ui/error-emitter/no-graphics.rs#no-color: [missing] -> pass (J0)
  • [ui] tests/ui/error-emitter/no-graphics.rs#terminal-urls: [missing] -> pass (J0)

Additionally, 4 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard b4fe65c19d1bb6e720c843086b785493c453028d --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. test-i686-gnu-nopt-2: 1h 23m -> 2h 36m (+88.3%)
  2. test-x86_64-mingw-2: 1h 37m -> 2h 47m (+71.9%)
  3. test-x86_64-msvc-2: 1h 34m -> 2h 39m (+67.7%)
  4. test-x86_64-gnu-llvm-22: 37m 22s -> 1h (+60.9%)
  5. dist-loongarch64-musl: 1h 18m -> 2h 4m (+57.6%)
  6. dist-x86_64-freebsd: 1h -> 1h 33m (+54.7%)
  7. dist-i686-mingw: 36m 45s -> 55m 7s (+50.0%)
  8. dist-arm-linux-gnueabi: 1h 3m -> 1h 32m (+46.0%)
  9. test-x86_64-gnu-aux: 3h 6m -> 1h 49m (-41.4%)
  10. test-x86_64-msvc-ext1: 1h 43m -> 2h 24m (+40.1%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b4fe65c): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
-1.4% [-3.1%, -0.3%] 22
Improvements ✅
(secondary)
-0.5% [-1.7%, -0.2%] 27
All ❌✅ (primary) -1.4% [-3.1%, -0.3%] 22

Max RSS (memory usage)

Results (secondary -1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.7% [6.7%, 6.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-6.5%, -3.8%] 2
All ❌✅ (primary) - - 0

Cycles

Results (primary -1.4%, secondary 9.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.1% [2.1%, 2.1%] 1
Regressions ❌
(secondary)
9.7% [3.5%, 23.1%] 12
Improvements ✅
(primary)
-3.2% [-3.4%, -3.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.4% [-3.4%, 2.1%] 3

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 484.187s -> 482.212s (-0.41%)
Artifact size: 406.04 MiB -> 406.08 MiB (0.01%)

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

Labels

A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants