diff options
| -rw-r--r-- | library/core/src/ops/index.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/ops/index.rs b/library/core/src/ops/index.rs index a8dea4e9b4e..515ccd6aa23 100644 --- a/library/core/src/ops/index.rs +++ b/library/core/src/ops/index.rs @@ -61,6 +61,10 @@ pub trait Index<Idx: ?Sized> { type Output: ?Sized; /// Performs the indexing (`container[index]`) operation. + /// + /// # Panics + /// + /// Panics if the index is out of bounds. #[stable(feature = "rust1", since = "1.0.0")] #[track_caller] fn index(&self, index: Idx) -> &Self::Output; @@ -161,6 +165,10 @@ see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#ind #[doc(alias = "[]")] pub trait IndexMut<Idx: ?Sized>: Index<Idx> { /// Performs the mutable indexing (`container[index]`) operation. + /// + /// # Panics + /// + /// Panics 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; |
