Skip to content

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Oct 1, 2025

rustc uses termcolor for styling and writing, while annotate-snippets uses anstyle for styling and currently writes directly to a String. When rendering directly to a terminal, there isn't/shouldn't be any differences. Still, there are differences in the escape sequences, which leads to slightly different output in JSON and SVG tests. As part of my work to have rustc use annotate-snippets, and to reduce the test differences between the two, I switched rustc to use anstlye and anstream for styling and writing.

The first commit migrates to anstyle and anstream and notably does not change the output. This is because it includes extra formatting to ensure that anstyle + anstream match the current output exactly. Most of this code is unnecessary, as it adds redundant resets or uses 256-color (8-bit) when it could be using 4-bit color. The subsequent commits remove this extra formatting while maintaining the correct output when rendered.

Zulip discussion

@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2025

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

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-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Oct 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2025

r? @lcnr

rustbot has assigned @lcnr.
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

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Muscraft Muscraft marked this pull request as draft October 1, 2025 03:58
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 1, 2025
@Urgau
Copy link
Member

Urgau commented Oct 1, 2025

I'm curious about the perf impact, let's see if there are any.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 1, 2025
refactor: Move to anstream + anstyle for styling
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 1, 2025
@lcnr
Copy link
Contributor

lcnr commented Oct 1, 2025

r? compiler

@rustbot rustbot assigned davidtwco and unassigned lcnr Oct 1, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 1, 2025

☀️ Try build successful (CI)
Build commit: 57098c1 (57098c130d013c0fdc87707aa7098579281756c6, parent: 1e1a39441bd11aba541a48ba714d939490fc7b85)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (57098c1): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -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.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) -1.0% [-1.0%, -1.0%] 1

Max RSS (memory usage)

Results (primary -1.0%, secondary 1.8%)

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)
1.8% [1.8%, 1.8%] 1
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.0% [-1.0%, -1.0%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 471.179s -> 472.5s (0.28%)
Artifact size: 387.76 MiB -> 387.69 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 1, 2025
@Muscraft Muscraft force-pushed the anstyle-anstream branch 2 times, most recently from 2f51fc9 to 1e5a5fd Compare October 2, 2025 12:00
@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Oct 2, 2025
@Muscraft Muscraft marked this pull request as ready for review October 2, 2025 12:00
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 2, 2025
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 17, 2025
@rustbot

This comment has been minimized.

@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Oct 17, 2025
@Muscraft Muscraft force-pushed the anstyle-anstream branch 2 times, most recently from 953fa48 to b85603e Compare October 20, 2025 04:28
@rustbot

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Oct 20, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Muscraft Muscraft requested a review from davidtwco October 20, 2025 21:33
@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 22, 2025

📌 Commit 5aedef1 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors 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 Oct 22, 2025
@bors
Copy link
Collaborator

bors commented Oct 22, 2025

⌛ Testing commit 5aedef1 with merge dc1feab...

@bors
Copy link
Collaborator

bors commented Oct 22, 2025

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing dc1feab to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 22, 2025
@bors bors merged commit dc1feab into rust-lang:master Oct 22, 2025
12 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 22, 2025
@Muscraft Muscraft deleted the anstyle-anstream branch October 22, 2025 19:38
@github-actions
Copy link
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 4d94478 (parent) -> dc1feab (this PR)

Test differences

Show 10 test diffs

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

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard dc1feabef242259d61bd930713de3250577c1c71 --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. dist-aarch64-linux: 6547.4s -> 9042.4s (38.1%)
  2. dist-apple-various: 3723.7s -> 4612.3s (23.9%)
  3. aarch64-apple: 8377.2s -> 10028.1s (19.7%)
  4. x86_64-rust-for-linux: 2725.9s -> 3003.4s (10.2%)
  5. aarch64-gnu-llvm-20-1: 3575.8s -> 3939.1s (10.2%)
  6. pr-check-1: 1968.4s -> 1772.4s (-10.0%)
  7. i686-gnu-1: 7563.6s -> 8156.7s (7.8%)
  8. x86_64-gnu-llvm-20: 2501.8s -> 2692.3s (7.6%)
  9. aarch64-gnu-llvm-20-2: 2239.2s -> 2407.1s (7.5%)
  10. dist-aarch64-apple: 7138.8s -> 6655.2s (-6.8%)
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
Collaborator

Finished benchmarking commit (dc1feab): 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
Improvements ✅
(primary)
-0.1% [-0.2%, -0.1%] 11
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.2%, -0.1%] 11

Max RSS (memory usage)

Results (secondary -0.8%)

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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 473.902s -> 472.366s (-0.32%)
Artifact size: 390.68 MiB -> 390.71 MiB (0.01%)

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

Labels

A-tidy Area: The tidy tool merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants