Skip to content

Specialize advance_back_by like the forward version - #163361

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cuviper:sync-advance_back_by
Sep 29, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cuviper:sync-advance_back_by

Conversation

@cuviper

@cuviper cuviper commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

We specialized advance_by in #141086, so it makes sense to have
advance_back_by use the same trick in reverse, i.e. try_rfold.

This also updates nth_back to mirror nth, and the rest of the
DoubleEndedIterator methods already match Iterator.

We specialized `advance_by` in rust-lang#141086, so it makes sense to have
`advance_back_by` use the same trick in reverse, i.e. `try_rfold`.

This also updates `nth_back` to mirror `nth`, and the rest of the
`DoubleEndedIterator` methods already match `Iterator`.
@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 Sep 25, 2026
@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
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 12 candidates
  • Random selection from 6 candidates

@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@cuviper

cuviper commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

The previous PR used a Cycle<slice::Iter> to demonstrate the benefit, but that doesn't work in reverse. Here's a different example with Flatten: https://iter.godbolt.org/z/ojWT3n9xz

@Darksonn Darksonn left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit cbc8109 has been approved by Darksonn

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 Sep 29, 2026
@Kobzol

Kobzol commented Sep 29, 2026

Copy link
Copy Markdown
Member

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 29, 2026
Specialize `advance_back_by` like the forward version
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 29, 2026
…rksonn

Specialize `advance_back_by` like the forward version

We specialized `advance_by` in rust-lang#141086, so it makes sense to have
`advance_back_by` use the same trick in reverse, i.e. `try_rfold`.

This also updates `nth_back` to mirror `nth`, and the rest of the
`DoubleEndedIterator` methods already match `Iterator`.
rust-bors Bot pushed a commit that referenced this pull request Sep 29, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #163024 (Add `Dir` equivalents of `fs::metadata` & `fs::symlink_metadata`)
 - #163279 (const and NonZero impl for clamp_magnitude())
 - #163361 (Specialize `advance_back_by` like the forward version)
@rust-bors

rust-bors Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 12cc55c (12cc55c134530eab53fe88d9f828b527840a7ba2)
Base parent: b46c90c (b46c90c5619a16a0c7e4d0f4e9e1ad4db4cf106e)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (12cc55c): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never 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.3% [0.3%, 0.4%] 3
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.3%, 0.4%] 3

Max RSS (memory usage)

Results (primary 1.9%, secondary 2.0%)

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

mean range count
Regressions ❌
(primary)
1.9% [1.2%, 2.7%] 2
Regressions ❌
(secondary)
2.9% [2.1%, 4.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) 1.9% [1.2%, 2.7%] 2

Cycles

Results (primary 4.5%)

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

mean range count
Regressions ❌
(primary)
4.5% [2.0%, 7.0%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.5% [2.0%, 7.0%] 2

Binary size

Results (primary 0.4%, 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.4% [0.2%, 0.6%] 9
Regressions ❌
(secondary)
0.4% [0.3%, 0.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.6%] 9

Bootstrap: 491.711s -> 492.163s (0.09%)
Artifact size: 406.38 MiB -> 406.43 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 29, 2026
@rust-bors

This comment has been minimized.

@cuviper

cuviper commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

IMO (though biased as author) that perf change is not significant enough to worry about.

@Kobzol

Kobzol commented Sep 29, 2026

Copy link
Copy Markdown
Member

Yeah, it's fine. I just wanted to see if we'd see any improvements.

rustbot label: +perf-regression-triaged

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

rust-bors Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: Darksonn
Duration: 3h 5m 6s
Pushing 4853db6 to main...

@rust-bors
rust-bors Bot merged commit 4853db6 into rust-lang:main Sep 29, 2026
15 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Sep 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 ea6bb45 (parent) -> 4853db6 (this PR)

Test differences

Show 42 test diffs

42 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 4853db6f65c9edf8e52fdf3f4eb711d188d15fc6 --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. optional-test-x86_64-gnu-autodiff: 33m 5s -> 57m 47s (+74.7%)
  2. dist-powerpc64-linux-gnu: 1h 2m -> 1h 34m (+52.4%)
  3. test-x86_64-gnu-miri: 55m -> 1h 23m (+51.3%)
  4. test-i686-gnu-nopt-2: 1h 34m -> 2h 22m (+50.3%)
  5. test-x86_64-msvc-ext3: 1h 28m -> 2h 2m (+38.8%)
  6. test-pr-check-1: 33m 26s -> 20m 34s (-38.5%)
  7. dist-armhf-linux: 1h 7m -> 1h 32m (+37.8%)
  8. dist-s390x-linux: 1h 9m -> 1h 35m (+37.3%)
  9. test-x86_64-gnu-distcheck: 1h 44m -> 2h 22m (+35.9%)
  10. dist-i686-linux: 1h 19m -> 1h 46m (+34.7%)
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 (4853db6): comparison URL.

Overall result: ❌ regressions - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.3% [0.3%, 0.4%] 3
Regressions ❌
(secondary)
0.3% [0.3%, 0.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.3%, 0.4%] 3

Max RSS (memory usage)

Results (primary 0.7%, secondary 2.9%)

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

mean range count
Regressions ❌
(primary)
2.5% [2.0%, 3.0%] 2
Regressions ❌
(secondary)
2.9% [2.1%, 4.9%] 20
Improvements ✅
(primary)
-2.8% [-2.8%, -2.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-2.8%, 3.0%] 3

Cycles

Results (secondary 1.5%)

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

Binary size

Results (primary 0.4%, 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.4% [0.2%, 0.6%] 15
Regressions ❌
(secondary)
0.3% [0.3%, 0.4%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.6%] 15

Bootstrap: 489.575s -> 489.608s (0.01%)
Artifact size: 406.37 MiB -> 406.35 MiB (-0.00%)

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. perf-regression Performance regression. 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.

5 participants