Skip to content

Commit 0ba9e1f

Browse files
committed
Auto merge of #22059 - Gankro:vec-split, r=alexcrichton
2 parents 00df325 + 09164f3 commit 0ba9e1f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/libcollections/vec.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,8 @@ impl<T> Vec<T> {
690690
/// Panics if the number of elements in the vector overflows a `usize`.
691691
///
692692
/// # Examples
693-
/// ```rust
693+
///
694+
/// ```
694695
/// let mut vec = vec![1, 2, 3];
695696
/// let mut vec2 = vec![4, 5, 6];
696697
/// vec.append(&mut vec2);
@@ -1002,8 +1003,13 @@ impl<T> Vec<T> {
10021003
///
10031004
/// Note that the capacity of `self` does not change.
10041005
///
1006+
/// # Panics
1007+
///
1008+
/// Panics if `at > len`.
1009+
///
10051010
/// # Examples
1006-
/// ```rust
1011+
///
1012+
/// ```
10071013
/// let mut vec = vec![1,2,3];
10081014
/// let vec2 = vec.split_off(1);
10091015
/// assert_eq!(vec, vec![1]);
@@ -1013,7 +1019,7 @@ impl<T> Vec<T> {
10131019
#[unstable(feature = "collections",
10141020
reason = "new API, waiting for dust to settle")]
10151021
pub fn split_off(&mut self, at: usize) -> Self {
1016-
assert!(at < self.len(), "`at` out of bounds");
1022+
assert!(at <= self.len(), "`at` out of bounds");
10171023

10181024
let other_len = self.len - at;
10191025
let mut other = Vec::with_capacity(other_len);

0 commit comments

Comments
 (0)