Skip to content

Consolidate panicking functions in slice/index.rs - #145137

Merged
bors merged 1 commit into
rust-lang:masterfrom
Kmeakin:km/optimize-slice-index-panicking
Aug 22, 2025
Merged

Consolidate panicking functions in slice/index.rs#145137
bors merged 1 commit into
rust-lang:masterfrom
Kmeakin:km/optimize-slice-index-panicking

Conversation

@Kmeakin

Copy link
Copy Markdown
Contributor

Consolidate all the panicking functions in slice/index.rs to use a single slice_index_fail function, similar to how it is done in str/traits.rs.

Split off from #145024

@rustbot

Copy link
Copy Markdown
Collaborator

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

@rustbotrustbot added 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-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 8, 2025
@rust-log-analyzer

This comment has been minimized.

@Kmeakin
Kmeakinforce-pushed the km/optimize-slice-index-panicking branch from 6473bd2 to 2cc5be6CompareAugust 9, 2025 00:06
@rustbot

Copy link
Copy Markdown
Collaborator

The Miri subtree was changed

cc @rust-lang/miri

@Kmeakin
Kmeakinforce-pushed the km/optimize-slice-index-panicking branch from 2cc5be6 to ea7033eCompareAugust 9, 2025 00:16
@rust-log-analyzer

This comment has been minimized.

@Kmeakin
Kmeakinforce-pushed the km/optimize-slice-index-panicking branch from ea7033e to 85e73f3CompareAugust 9, 2025 01:16
@rust-log-analyzer

This comment has been minimized.

@xizheyin

xizheyin commented Aug 9, 2025

Copy link
Copy Markdown
Member

Thanks for the code. You could try ./x test codegen-llvm to test it locally first.
https://rustc-dev-guide.rust-lang.org/tests/intro.html

@Kmeakin
Kmeakinforce-pushed the km/optimize-slice-index-panicking branch from 85e73f3 to 9adc058CompareAugust 9, 2025 19:16
@rust-log-analyzer

This comment has been minimized.

@Kmeakin
Kmeakinforce-pushed the km/optimize-slice-index-panicking branch from 9adc058 to 5c0421dCompareAugust 9, 2025 21:52
@Kmeakin

Copy link
Copy Markdown
ContributorAuthor

@bors try @rust-timer queue

@rust-bors

rust-borsBot commented Aug 10, 2025

Copy link
Copy Markdown
Contributor

@Kmeakin: 🔑 Insufficient privileges: not in try users

@rust-timer

This comment has been minimized.

@jhpratt

Copy link
Copy Markdown
Member

I'm not convinced that this is an improvement, but on the other hand optimizations are weird.

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot added a commit that referenced this pull request Aug 11, 2025
…<try>
Consolidate panicking functions in `slice/index.rs`
@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 11, 2025
@rust-bors

rust-borsBot commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: fa10c86 (fa10c86b130152ce0be5ff020bd92275c432f6b5, parent: fce0e74720d199eb7839fdb51af35ac5226da178)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (fa10c86): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

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

meanrangecount
Regressions ❌
(primary)
1.0%[1.0%, 1.0%]1
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
-0.7%[-1.2%, -0.3%]5
Improvements ✅
(secondary)
-0.2%[-0.3%, -0.1%]2
All ❌✅ (primary)-0.5%[-1.2%, 1.0%]6

Max RSS (memory usage)

Results (primary 1.6%, secondary -2.5%)

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

meanrangecount
Regressions ❌
(primary)
3.0%[1.1%, 4.9%]4
Regressions ❌
(secondary)
2.4%[2.4%, 2.4%]1
Improvements ✅
(primary)
-3.8%[-3.8%, -3.8%]1
Improvements ✅
(secondary)
-3.7%[-4.5%, -2.5%]4
All ❌✅ (primary)1.6%[-3.8%, 4.9%]5

Cycles

Results (primary 2.6%, secondary 3.2%)

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

meanrangecount
Regressions ❌
(primary)
2.6%[2.6%, 2.6%]1
Regressions ❌
(secondary)
4.6%[2.4%, 6.6%]4
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.4%[-2.4%, -2.4%]1
All ❌✅ (primary)2.6%[2.6%, 2.6%]1

Binary size

Results (primary -0.1%, secondary -0.2%)

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

meanrangecount
Regressions ❌
(primary)
0.1%[0.0%, 0.4%]13
Regressions ❌
(secondary)
0.1%[0.0%, 0.2%]2
Improvements ✅
(primary)
-0.2%[-0.4%, -0.0%]33
Improvements ✅
(secondary)
-0.2%[-0.2%, -0.0%]41
All ❌✅ (primary)-0.1%[-0.4%, 0.4%]46

Bootstrap: 464.993s -> 463.159s (-0.39%)
Artifact size: 377.36 MiB -> 377.58 MiB (0.06%)

@rustbotrustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 12, 2025
@borsbors 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 Aug 20, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 20, 2025
…nicking, r=jhpratt
Consolidate panicking functions in `slice/index.rs`
Consolidate all the panicking functions in `slice/index.rs` to use a single `slice_index_fail` function, similar to how it is done in `str/traits.rs`.
Split off from rust-lang#145024
@jhprattjhpratt mentioned this pull request Aug 20, 2025
bors added a commit that referenced this pull request Aug 20, 2025
Rollup of 14 pull requests
Successful merges:
- #143383 (stabilize `const_array_each_ref`)
- #144443 (Make target pointer width in target json an integer)
- #144758 ([Doc] Add links to the various collections)
- #144915 (Defer tail call ret ty equality to check_tail_calls)
- #145137 (Consolidate panicking functions in `slice/index.rs`)
- #145256 (Add new `--test-codegen-backend` bootstrap option)
- #145297 (fix(debuginfo): handle false positives in overflow check)
- #145415 (std_detect: RISC-V: implement implication to "C")
- #145642 (Do not use effective_visibilities query for Adt types of a local trait while proving a where-clause)
- #145650 (Fix JS search scripts path)
- #145654 (Download CI GCC into the correct directory)
- #145662 (Enforce correct number of arguments for `"x86-interrupt"` functions)
- #145674 (Enable triagebot `[review-changes-since]` feature)
- #145678 (Fix typo in docstring)
r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 21, 2025
…nicking, r=jhpratt
Consolidate panicking functions in `slice/index.rs`
Consolidate all the panicking functions in `slice/index.rs` to use a single `slice_index_fail` function, similar to how it is done in `str/traits.rs`.
Split off from rust-lang#145024
@jhprattjhpratt mentioned this pull request Aug 21, 2025
bors added a commit that referenced this pull request Aug 21, 2025
Rollup of 15 pull requests
Successful merges:
- #143383 (stabilize `const_array_each_ref`)
- #144758 ([Doc] Add links to the various collections)
- #144915 (Defer tail call ret ty equality to check_tail_calls)
- #145137 (Consolidate panicking functions in `slice/index.rs`)
- #145256 (Add new `--test-codegen-backend` bootstrap option)
- #145297 (fix(debuginfo): handle false positives in overflow check)
- #145415 (std_detect: RISC-V: implement implication to "C")
- #145590 (Prevent impossible combinations in `ast::ModKind`.)
- #145621 (Fix some doc typos)
- #145642 (Do not use effective_visibilities query for Adt types of a local trait while proving a where-clause)
- #145650 (Fix JS search scripts path)
- #145654 (Download CI GCC into the correct directory)
- #145662 (Enforce correct number of arguments for `"x86-interrupt"` functions)
- #145674 (Enable triagebot `[review-changes-since]` feature)
- #145678 (Fix typo in docstring)
r? `@ghost`
`@rustbot` modify labels: rollup
@jhpratt

Copy link
Copy Markdown
Member

@bors r- #145691 (comment)

mir-opt codegen needs blessing

@borsbors 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 Aug 21, 2025
Consolidate all the panicking functions in `slice/index.rs` to use a single
`slice_index_fail` function, similar to how it is done in `str/traits.rs`.
@Kmeakin
Kmeakinforce-pushed the km/optimize-slice-index-panicking branch from 7d5c9ca to 377a0c8CompareAugust 21, 2025 10:15
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@Kmeakin

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@rustbotrustbot 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 Aug 21, 2025
@jhpratt

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Aug 21, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 377a0c8 has been approved by jhpratt

It is now in the queue for this repository.

@borsbors 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 Aug 21, 2025
@jhprattjhpratt mentioned this pull request Aug 21, 2025
bors added a commit that referenced this pull request Aug 21, 2025
Rollup of 16 pull requests
Successful merges:
- #137494 (libstd: init(): dup() subsequent /dev/nulls instead of opening them again)
- #144541 (c-variadic: multiple ABIs in the same program for arm)
- #144613 (aarch64-nintendo-switch-freestanding - Enable CPU features that are always available in a live system (crypto instructions, plus explicit NEON).)
- #144780 (Add a method to dump MIR in the middle of MIR building)
- #145137 (Consolidate panicking functions in `slice/index.rs`)
- #145507 (Refactor attribute parsing to improve ergonomics and some diagnostics)
- #145604 (Gate static closures behind a parser feature)
- #145648 (Add two tidy dependency checks)
- #145661 (update some s390x codegen tests)
- #145672 (Instantiate higher-ranked binder with erased when checking `IntoIterator` predicate for query instability)
- #145689 (Migrate `panic_unwind` to use `cfg_select!`)
- #145700 (Handle `ReEarlyParam` in `type_name`.)
- #145703 (Remove MIPS targets from CI LLVM platforms)
- #145704 (ci: don't cleanup windows disk)
- #145705 (remove an `as` cast in prefetch codegen)
- #145712 (Update outdated link in bound region comments)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 02deabb into rust-lang:masterAug 22, 2025
10 checks passed
@rustbotrustbot added this to the 1.91.0 milestone Aug 22, 2025
rust-timer added a commit that referenced this pull request Aug 22, 2025
Rollup merge of #145137 - Kmeakin:km/optimize-slice-index-panicking, r=jhpratt
Consolidate panicking functions in `slice/index.rs`
Consolidate all the panicking functions in `slice/index.rs` to use a single `slice_index_fail` function, similar to how it is done in `str/traits.rs`.
Split off from #145024
github-actionsBot pushed a commit to rust-lang/miri that referenced this pull request Aug 22, 2025
Rollup of 16 pull requests
Successful merges:
- rust-lang/rust#137494 (libstd: init(): dup() subsequent /dev/nulls instead of opening them again)
- rust-lang/rust#144541 (c-variadic: multiple ABIs in the same program for arm)
- rust-lang/rust#144613 (aarch64-nintendo-switch-freestanding - Enable CPU features that are always available in a live system (crypto instructions, plus explicit NEON).)
- rust-lang/rust#144780 (Add a method to dump MIR in the middle of MIR building)
- rust-lang/rust#145137 (Consolidate panicking functions in `slice/index.rs`)
- rust-lang/rust#145507 (Refactor attribute parsing to improve ergonomics and some diagnostics)
- rust-lang/rust#145604 (Gate static closures behind a parser feature)
- rust-lang/rust#145648 (Add two tidy dependency checks)
- rust-lang/rust#145661 (update some s390x codegen tests)
- rust-lang/rust#145672 (Instantiate higher-ranked binder with erased when checking `IntoIterator` predicate for query instability)
- rust-lang/rust#145689 (Migrate `panic_unwind` to use `cfg_select!`)
- rust-lang/rust#145700 (Handle `ReEarlyParam` in `type_name`.)
- rust-lang/rust#145703 (Remove MIPS targets from CI LLVM platforms)
- rust-lang/rust#145704 (ci: don't cleanup windows disk)
- rust-lang/rust#145705 (remove an `as` cast in prefetch codegen)
- rust-lang/rust#145712 (Update outdated link in bound region comments)
r? `@ghost`
`@rustbot` modify labels: rollup
@Kmeakin
Kmeakin deleted the km/optimize-slice-index-panicking branch August 24, 2025 11:56
github-actionsBot pushed a commit to model-checking/verify-rust-std that referenced this pull request Aug 26, 2025
…nicking, r=jhpratt
Consolidate panicking functions in `slice/index.rs`
Consolidate all the panicking functions in `slice/index.rs` to use a single `slice_index_fail` function, similar to how it is done in `str/traits.rs`.
Split off from rust-lang#145024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regressionPerformance regression.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant 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.

12 participants

@Kmeakin@rustbot@rust-log-analyzer@xizheyin@rust-timer@jhpratt@Kobzol@bors@Zalathar@klensy@jieyouxu@okaneco