about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/liballoc/vec.rs')
-rw-r--r--src/liballoc/vec.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index e1c5ab15bb5..ba3b3dfbfc2 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -819,6 +819,8 @@ impl<T> Vec<T> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub unsafe fn set_len(&mut self, new_len: usize) {
+        debug_assert!(new_len <= self.capacity());
+
         self.len = new_len;
     }