Skip to content

Remove unnecessary get_unchecked#155855

Open
ChrisDenton wants to merge 1 commit intorust-lang:mainfrom
ChrisDenton:remove-unsafe-get
Open

Remove unnecessary get_unchecked#155855
ChrisDenton wants to merge 1 commit intorust-lang:mainfrom
ChrisDenton:remove-unsafe-get

Conversation

@ChrisDenton
Copy link
Copy Markdown
Member

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
@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 Apr 27, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 27, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@ChrisDenton
Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 27, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

☀️ Try build successful (CI)
Build commit: 6395398 (6395398753df5c5854178b39b30e9b7692892504, parent: ca9a134e0985765ded9cfdde4030a5df4db7e2bd)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6395398): comparison URL.

Overall result: no relevant changes - no action needed

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

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 2.2%, secondary 0.5%)

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

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

Cycles

Results (primary -2.5%, secondary 3.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)
3.2% [2.0%, 4.2%] 8
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.5% [-2.5%, -2.5%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 488.117s -> 486.46s (-0.34%)
Artifact size: 393.52 MiB -> 393.51 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 27, 2026
@Mark-Simulacrum
Copy link
Copy Markdown
Member

I'd guess there's very little dependency on this from the compiler, so probably not super meaningful results in perf. I'm OK approving it though given your local benchmarking.

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

📌 Commit 69cc5fa 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 May 4, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 4, 2026
…ark-Simulacrum

Remove unnecessary `get_unchecked`

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 4, 2026
…ark-Simulacrum

Remove unnecessary `get_unchecked`

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
rust-bors Bot pushed a commit that referenced this pull request May 4, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #155848 ([doc]: Revert `core::io::ErrorKind` doc changes)
 - #155855 (Remove unnecessary `get_unchecked`)
 - #156062 (Added command-line argument support for `wasm32-wali-linux-musl`)
 - #155543 (docs(unstable-book): Document const generics features)
 - #156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - #156082 (Move tests associated types)
 - #156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - #156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - #156128 (.mailmap: prefer matching just based on commit emails)
 - #156135 (Remove most uses of def_id_to_node_id)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 4, 2026
…ark-Simulacrum

Remove unnecessary `get_unchecked`

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
rust-bors Bot pushed a commit that referenced this pull request May 4, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #155848 ([doc]: Revert `core::io::ErrorKind` doc changes)
 - #155855 (Remove unnecessary `get_unchecked`)
 - #155543 (docs(unstable-book): Document const generics features)
 - #155962 (`rustc`: `target_features`: allow for `cfg`-only stable `target_features`)
 - #156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - #156082 (Move tests associated types)
 - #156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - #156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - #156128 (.mailmap: prefer matching just based on commit emails)
 - #156135 (Remove most uses of def_id_to_node_id)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 4, 2026
…ark-Simulacrum

Remove unnecessary `get_unchecked`

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
rust-bors Bot pushed a commit that referenced this pull request May 4, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #155848 ([doc]: Revert `core::io::ErrorKind` doc changes)
 - #155855 (Remove unnecessary `get_unchecked`)
 - #155543 (docs(unstable-book): Document const generics features)
 - #155962 (`rustc`: `target_features`: allow for `cfg`-only stable `target_features`)
 - #156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - #156082 (Move tests associated types)
 - #156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - #156103 (Fix E0040 suggestion for explicit `Drop::drop` UFCS calls)
 - #156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - #156128 (.mailmap: prefer matching just based on commit emails)
 - #156135 (Remove most uses of def_id_to_node_id)
 - #156152 (Update books)
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 5, 2026
…ark-Simulacrum

Remove unnecessary `get_unchecked`

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
rust-bors Bot pushed a commit that referenced this pull request May 5, 2026
Rollup of 16 pull requests

Successful merges:

 - #155848 ([doc]: Revert `core::io::ErrorKind` doc changes)
 - #155855 (Remove unnecessary `get_unchecked`)
 - #155543 (docs(unstable-book): Document const generics features)
 - #155962 (`rustc`: `target_features`: allow for `cfg`-only stable `target_features`)
 - #156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - #156082 (Move tests associated types)
 - #156087 (Improve `&pin` reference-pattern suggestions)
 - #156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - #156103 (Fix E0040 suggestion for explicit `Drop::drop` UFCS calls)
 - #156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - #156122 (Add a `doc_cfg` regression test to ensure foreign types impls are working as expected)
 - #156128 (.mailmap: prefer matching just based on commit emails)
 - #156135 (Remove most uses of def_id_to_node_id)
 - #156152 (Update books)
 - #156154 (tests: mark import UI tests as check-pass)
 - #156162 (Update `browser-ui-test` version to `0.23.5`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants