Skip to content

core: respect precision in ByteStr Display#153025

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
joboet:bytestr_precision_display
Mar 9, 2026
Merged

core: respect precision in ByteStr Display#153025
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
joboet:bytestr_precision_display

Conversation

@joboet
Copy link
Member

@joboet joboet commented Feb 23, 2026

Fixes #153022.

ByteStr's Display implementation didn't respect the precision parameter. Just like Formatter::pad, this is fixed by counting off the characters in the string and truncating after the requested length – with the added complication that the ByteStr needs to be divided into chunks first. By including a fast path that avoids counting the characters when no parameters were specified this should also fix the performance regressions caused by #152865.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 23, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2026

r? @jhpratt

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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

Just to get ahead of potential perf (shouldn't block merging as a correctness fix).

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 24, 2026
core: respect precision in `ByteStr` `Display`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 24, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 24, 2026

☀️ Try build successful (CI)
Build commit: 2448715 (2448715f97539c847c74001978350d9b0ccc64f1, parent: b3869b94cd1ed4bfa2eb28f301535d5e9599c713)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2448715): comparison URL.

Overall result: ✅ 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
Improvements ✅
(primary)
-0.5% [-0.8%, -0.3%] 2
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) -0.5% [-0.8%, -0.3%] 2

Max RSS (memory usage)

Results (primary 1.1%, secondary 4.8%)

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

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
4.8% [4.8%, 4.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 1

Cycles

Results (primary 7.1%)

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

mean range count
Regressions ❌
(primary)
7.1% [7.1%, 7.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 7.1% [7.1%, 7.1%] 1

Binary size

Results (primary 0.0%, secondary 0.3%)

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

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 4
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 4

Bootstrap: 479.41s -> 478.565s (-0.18%)
Artifact size: 395.68 MiB -> 395.73 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 24, 2026
@jhpratt
Copy link
Member

jhpratt commented Mar 1, 2026

@rustbot reroll

@rustbot rustbot assigned Mark-Simulacrum and unassigned jhpratt Mar 1, 2026
@Mark-Simulacrum
Copy link
Member

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 8, 2026

📌 Commit fa99d5b has been approved by Mark-Simulacrum

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 Mar 8, 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 Mar 9, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 9, 2026

☀️ Test successful - CI
Approved by: Mark-Simulacrum
Duration: 3h 13m 52s
Pushing 98e7077 to main...

@rust-bors rust-bors bot merged commit 98e7077 into rust-lang:main Mar 9, 2026
13 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

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 eda4fc7 (parent) -> 98e7077 (this PR)

Test differences

Show 3 test diffs

3 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 98e7077b903559d7a4fafb775cd5292cc9427b67 --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-apple: 3h 24m -> 1h 53m (-44.4%)
  2. x86_64-rust-for-linux: 53m 7s -> 42m 34s (-19.9%)
  3. dist-apple-various: 1h 49m -> 2h 10m (+19.2%)
  4. x86_64-gnu-miri: 1h 33m -> 1h 17m (-16.3%)
  5. pr-check-1: 33m 12s -> 27m 51s (-16.1%)
  6. i686-gnu-nopt-1: 2h 21m -> 2h 5m (-11.3%)
  7. i686-gnu-2: 1h 40m -> 1h 29m (-10.7%)
  8. dist-powerpc64le-linux-musl: 1h 43m -> 1h 33m (-9.9%)
  9. x86_64-gnu: 2h 30m -> 2h 16m (-9.6%)
  10. x86_64-gnu-llvm-20: 1h 19m -> 1h 11m (-9.3%)
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 (98e7077): 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.4% [-0.8%, -0.2%] 4
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) -0.4% [-0.8%, -0.2%] 4

Max RSS (memory usage)

Results (secondary 1.1%)

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

Cycles

Results (primary -2.3%, secondary 2.7%)

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

Binary size

Results (primary 0.0%, secondary 0.3%)

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

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 4
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 4

Bootstrap: 479.713s -> 479.865s (0.03%)
Artifact size: 396.94 MiB -> 395.05 MiB (-0.48%)

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

Labels

merged-by-bors This PR was explicitly merged by bors. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

std::path::Display Nightly regression with precision

5 participants