about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexis <a.beingessner@gmail.com>2015-02-07 14:58:58 -0500
committerAlexis <a.beingessner@gmail.com>2015-02-07 14:58:58 -0500
commit09164f3acfd7c444bb547515e669b59e9f93ddfa (patch)
tree480cd9400ec2eb4cb6989e26e75e8d21c95070b3
parent80627cd3cc4099b76cb2fb26ebe2f2f8a6c2335e (diff)
downloadrust-09164f3acfd7c444bb547515e669b59e9f93ddfa.tar.gz
rust-09164f3acfd7c444bb547515e669b59e9f93ddfa.zip
minor fixes to Vec docs and bounds check
-rw-r--r--src/libcollections/vec.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 4a082c3616c..70097c956cd 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -690,7 +690,8 @@ impl<T> Vec<T> {
     /// Panics if the number of elements in the vector overflows a `usize`.
     ///
     /// # Examples
-    /// ```rust
+    ///
+    /// ```
     /// let mut vec = vec![1, 2, 3];
     /// let mut vec2 = vec![4, 5, 6];
     /// vec.append(&mut vec2);
@@ -1002,8 +1003,13 @@ impl<T> Vec<T> {
     ///
     /// Note that the capacity of `self` does not change.
     ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    ///
     /// # Examples
-    /// ```rust
+    ///
+    /// ```
     /// let mut vec = vec![1,2,3];
     /// let vec2 = vec.split_off(1);
     /// assert_eq!(vec, vec![1]);
@@ -1013,7 +1019,7 @@ impl<T> Vec<T> {
     #[unstable(feature = "collections",
                reason = "new API, waiting for dust to settle")]
     pub fn split_off(&mut self, at: usize) -> Self {
-        assert!(at < self.len(), "`at` out of bounds");
+        assert!(at <= self.len(), "`at` out of bounds");
 
         let other_len = self.len - at;
         let mut other = Vec::with_capacity(other_len);