Add safety section for SliceIndex::get_unchecked(mut)#158382
Merged
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @clarfonthey (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
|
Discussed this with a few people; even though this is unstable documentation, this is strictly an improvement, and this documentation is still public even though it's for an unstable method. @bors r+ rollup=always |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 26, 2026
…uwer Rollup of 15 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #158360 (Various borrowck cleanups and param_env/opaque_types_defined_by query simplifications for typeck children) - #158438 (Use rigidness marker in fast_reject) - #157127 (cg_LLVM: Stop needing an alloca for volatile loads) - #158376 (Suggest `>=` for `=>` typo in closure and call argument positions) - #158185 (perf: Make stable_crate_ids reads lock-free after crate loading) - #158244 (Attribute docs `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` ) - #158355 (Fixup the refactoring errors in #156246) - #158361 (Move `check_ffi_pure` into the attribute parser) - #158382 (Add safety section for SliceIndex::get_unchecked(mut)) - #158399 (std: truncate thread names on NetBSD) - #158418 (Eliminate double length check in `Vec::into_array`) - #158430 (Guard clone suggestion against empty obligation errors) - #158446 (Update Enzyme submodule) - #158448 (Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 26, 2026
…uwer Rollup of 15 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #158360 (Various borrowck cleanups and param_env/opaque_types_defined_by query simplifications for typeck children) - #158438 (Use rigidness marker in fast_reject) - #157127 (cg_LLVM: Stop needing an alloca for volatile loads) - #158376 (Suggest `>=` for `=>` typo in closure and call argument positions) - #158185 (perf: Make stable_crate_ids reads lock-free after crate loading) - #158244 (Attribute docs `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` ) - #158355 (Fixup the refactoring errors in #156246) - #158361 (Move `check_ffi_pure` into the attribute parser) - #158382 (Add safety section for SliceIndex::get_unchecked(mut)) - #158399 (std: truncate thread names on NetBSD) - #158418 (Eliminate double length check in `Vec::into_array`) - #158430 (Guard clone suggestion against empty obligation errors) - #158446 (Update Enzyme submodule) - #158448 (Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 27, 2026
…uwer Rollup of 15 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #158360 (Various borrowck cleanups and param_env/opaque_types_defined_by query simplifications for typeck children) - #158438 (Use rigidness marker in fast_reject) - #157127 (cg_LLVM: Stop needing an alloca for volatile loads) - #158376 (Suggest `>=` for `=>` typo in closure and call argument positions) - #158185 (perf: Make stable_crate_ids reads lock-free after crate loading) - #158244 (Attribute docs `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` ) - #158355 (Fixup the refactoring errors in #156246) - #158361 (Move `check_ffi_pure` into the attribute parser) - #158382 (Add safety section for SliceIndex::get_unchecked(mut)) - #158399 (std: truncate thread names on NetBSD) - #158418 (Eliminate double length check in `Vec::into_array`) - #158430 (Guard clone suggestion against empty obligation errors) - #158446 (Update Enzyme submodule) - #158448 (Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`)
rust-timer
added a commit
that referenced
this pull request
Jun 27, 2026
Rollup merge of #158382 - yilin0518:fix_slice_index, r=clarfonthey Add safety section for SliceIndex::get_unchecked(mut) This PR adds `# Safety` sections to the documentation for the unsafe `SliceIndex::get_unchecked` and `SliceIndex::get_unchecked_mut` trait methods. The existing documentation already described the undefined behavior conditions for out-of-bounds indices and dangling slice pointers. This change keeps that content unchanged, but moves it under the standard rustdoc `# Safety` heading expected for unsafe functions. No behavior changes.
pull Bot
pushed a commit
to LeeeeeeM/miri
that referenced
this pull request
Jun 27, 2026
…uwer Rollup of 15 pull requests Successful merges: - rust-lang/rust#153697 (Add arg splat experiment initial tuple impl) - rust-lang/rust#158360 (Various borrowck cleanups and param_env/opaque_types_defined_by query simplifications for typeck children) - rust-lang/rust#158438 (Use rigidness marker in fast_reject) - rust-lang/rust#157127 (cg_LLVM: Stop needing an alloca for volatile loads) - rust-lang/rust#158376 (Suggest `>=` for `=>` typo in closure and call argument positions) - rust-lang/rust#158185 (perf: Make stable_crate_ids reads lock-free after crate loading) - rust-lang/rust#158244 (Attribute docs `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` ) - rust-lang/rust#158355 (Fixup the refactoring errors in rust-lang/rust#156246) - rust-lang/rust#158361 (Move `check_ffi_pure` into the attribute parser) - rust-lang/rust#158382 (Add safety section for SliceIndex::get_unchecked(mut)) - rust-lang/rust#158399 (std: truncate thread names on NetBSD) - rust-lang/rust#158418 (Eliminate double length check in `Vec::into_array`) - rust-lang/rust#158430 (Guard clone suggestion against empty obligation errors) - rust-lang/rust#158446 (Update Enzyme submodule) - rust-lang/rust#158448 (Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
# Safetysections to the documentation for the unsafeSliceIndex::get_uncheckedandSliceIndex::get_unchecked_muttrait methods.The existing documentation already described the undefined behavior conditions for out-of-bounds indices and dangling slice pointers. This change keeps that content unchanged, but moves it under the standard rustdoc
# Safetyheading expected for unsafe functions.No behavior changes.