Skip to content

Commit b47f222

Browse files
committed
auto merge of #15214 : tbu-/rust/pr_doc_vecinsert, r=huonw
2 parents e6d6c8b + a208842 commit b47f222

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcollections/vec.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -956,14 +956,17 @@ impl<T> Vec<T> {
956956
///
957957
/// # Failure
958958
///
959-
/// Fails if `index` is out of bounds of the vector.
959+
/// Fails if `index` is not between `0` and the vector's length (both
960+
/// bounds inclusive).
960961
///
961962
/// # Example
962963
///
963964
/// ```rust
964965
/// let mut vec = vec!(1i, 2, 3);
965966
/// vec.insert(1, 4);
966967
/// assert_eq!(vec, vec!(1, 4, 2, 3));
968+
/// vec.insert(4, 5);
969+
/// assert_eq!(vec, vec!(1, 4, 2, 3, 5));
967970
/// ```
968971
pub fn insert(&mut self, index: uint, element: T) {
969972
let len = self.len();

0 commit comments

Comments
 (0)