Skip to content

Document that index and index_mut can panic #84301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Say that it "may panic"
  • Loading branch information
r00ster authored Apr 18, 2021
commit c86ffe9e8910cb1bac1737878a524e146b54375e
4 changes: 2 additions & 2 deletions library/core/src/ops/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub trait Index<Idx: ?Sized> {
///
/// # Panics
///
/// Panics if the index is out of bounds.
/// May panic if the index is out of bounds.
#[stable(feature = "rust1", since = "1.0.0")]
#[track_caller]
fn index(&self, index: Idx) -> &Self::Output;
Expand Down Expand Up @@ -168,7 +168,7 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
///
/// # Panics
///
/// Panics if the index is out of bounds.
/// May panic if the index is out of bounds.
#[stable(feature = "rust1", since = "1.0.0")]
#[track_caller]
fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
Expand Down