Skip to content

nightly SliceIndex::get_unchecked, get_unchecked_mut docs #122234

Closed
@ratmice

Description

@ratmice

Location

https://doc.rust-lang.org/std/slice/trait.SliceIndex.html#tymethod.get_unchecked
https://doc.rust-lang.org/std/slice/trait.SliceIndex.html#tymethod.get_unchecked_mut

Summary

The documentation for these methods state respectively:

Returns a shared reference to the output at this location

Returns a mutable reference to the output at this location

However these clearly return pointers rather than references.
Later on they state the following restrictions, which make sense for references but it isn't clear to me that this restriction is necessary for pointers.

Calling this method with an out-of-bounds index or a dangling slice pointer is undefined behavior even if the resulting reference is not used.

At the very least the s/reference/pointer/ change needs to be made there too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions