Add a debug_assert to Vec::set_len
This commit is contained in:
parent
a16e1a781d
commit
1fd971c3b9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user