Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

remove an unnecessary allocation from char_iter.collect::<String>() - #166729

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
the8472:fix-string-append-allocation-behavior
Nov 29, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
the8472:fix-string-append-allocation-behavior

Conversation

@the8472

@the8472 the8472 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

View all comments

fixes #166566

Confirmed by running the reproducer locally.

@rustbot rustbot added A-str Area: `str` and `String` 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 Nov 28, 2026
@rustbot

rustbot commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

r? @joboet

rustbot has assigned @joboet.
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: libs
  • libs expanded to 38 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, joboet

@the8472 the8472 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 28, 2026
@the8472

the8472 commented Nov 28, 2026

Copy link
Copy Markdown
Member Author

Perhaps this will also resolve #159916 (comment)

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 28, 2026
…, r=<try>

remove an unnecessary allocation from char_iter.collect::<String>()
@rust-bors

rust-bors Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b161381 (b1613814d8ac0132da56cf657b9adb547d339272)
Base parent: 6181cc4 (6181cc4f077f1a16ce605e297173b01c6ddff553)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (b161381): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@bors rollup=iffy rustc-perf
@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.5%, -0.5%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.5%, -0.5%] 3

Max RSS (memory usage)

Results (primary 3.7%, secondary -2.3%)

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

mean range count
Regressions ❌
(primary)
3.7% [3.7%, 3.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-6.0%, -0.4%] 3
All ❌✅ (primary) 3.7% [3.7%, 3.7%] 1

Cycles

Results (primary -3.0%, secondary -0.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)
0.7% [0.6%, 0.7%] 3
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
-1.0% [-1.2%, -0.9%] 3
All ❌✅ (primary) -3.0% [-3.0%, -3.0%] 1

Binary size

Results (primary -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.1% [0.1%, 0.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-3.1%, -0.0%] 10
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.1% [-3.1%, 0.1%] 12

Bootstrap: 462.27s -> 463.369s (0.24%)
Artifact size: 406.53 MiB -> 406.55 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 29, 2026
@joshtriplett

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 621cd1f has been approved by joshtriplett

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 29, 2026
@hanna-kruppe

hanna-kruppe commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

(Raced)

@rustbot rustbot assigned hanna-kruppe and unassigned joboet Nov 29, 2026
@rust-bors

rust-bors Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 621cd1f has been approved by hanna-kruppe

It is now in the queue for this repository.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 29, 2026
…, r=hanna-kruppe

remove an unnecessary allocation from char_iter.collect::<String>()

fixes #166566

Confirmed by running the reproducer locally.
@hanna-kruppe

Copy link
Copy Markdown
Contributor

Oops 😅
@bors r=joshtriplett

@rust-bors

rust-bors Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 621cd1f has been approved by joshtriplett

It is now in the queue for this repository.

@hanna-kruppe

Copy link
Copy Markdown
Contributor

@bors yield

@rust-bors

rust-bors Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #166729.

@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 29, 2026
@rust-bors

rust-bors Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: joshtriplett
Duration: 3h 27m 16s
Pushing 7f04ca5 to main...

@rust-bors
rust-bors Bot merged commit 7f04ca5 into rust-lang:main Nov 29, 2026
16 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 29, 2026
@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 2860a8a (parent) -> 7f04ca5 (this PR)

Test differences

Show 2 test diffs

2 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 7f04ca52bddaf079d06bb4b9c8088089117ed8af --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-x86_64-msvc-ext2: 57m 26s -> 1h 39m (+73.9%)
  2. test-x86_64-gnu-distcheck: 1h 34m -> 2h 23m (+51.7%)
  3. test-x86_64-gnu-next-trait-solver-polonius: 42m 2s -> 59m 29s (+41.5%)
  4. test-x86_64-mingw-1: 2h 59m -> 1h 47m (-40.2%)
  5. test-i686-gnu-2: 1h 38m -> 58m 56s (-39.9%)
  6. test-various: 2h 20m -> 1h 26m (-38.3%)
  7. dist-s390x-linux: 1h 37m -> 1h (-37.3%)
  8. test-x86_64-msvc-1: 2h 47m -> 1h 45m (-37.1%)
  9. dist-ohos-armv7: 54m 33s -> 1h 13m (+34.6%)
  10. test-x86_64-gnu-llvm-22-3: 1h 58m -> 1h 17m (-34.4%)
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

Finished benchmarking commit (7f04ca5): 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.5%, -0.4%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.5%, -0.4%] 3

Max RSS (memory usage)

Results (primary -2.2%, secondary -0.4%)

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

Cycles

Results (secondary 0.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)
1.3% [0.6%, 3.4%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.8%, -0.5%] 2
All ❌✅ (primary) - - 0

Binary size

Results (primary -1.0%)

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

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.2%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.2% [-3.1%, -0.0%] 11
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.0% [-3.1%, 0.2%] 13

Bootstrap: 462.596s -> 463.631s (0.22%)
Artifact size: 406.51 MiB -> 406.47 MiB (-0.01%)

@rustbot

rustbot commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

beta backport approved as per libs team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle. Backport labels are handled by them.

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Dec 1, 2026
@cuviper cuviper mentioned this pull request Dec 2, 2026
@cuviper cuviper modified the milestones: 1.102.0, 1.101.0 Dec 2, 2026
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 2, 2026
rust-bors Bot pushed a commit that referenced this pull request Dec 4, 2026
[beta] backports

- Avoid hoisting uninitialized reads in EarlyOtherwiseBranch #164864
- remove an unnecessary allocation from `char_iter.collect::<String>()` #166729
- Update LLVM submodule #166871

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

Labels

A-str Area: `str` and `String` beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

1.101 beta crater regression: collecting into a String can unnecessarily reallocate

7 participants