Skip to content

Commit

Permalink
Add another assert
Browse files Browse the repository at this point in the history
  • Loading branch information
MaloJaffre committed Aug 29, 2018
1 parent 1908892 commit 21d2a6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use core::cmp::Ordering;
use core::fmt;
use core::isize;
use core::iter::{repeat, FromIterator, FusedIterator};
use core::mem;
use core::ops::Bound::{Excluded, Included, Unbounded};
Expand Down Expand Up @@ -210,6 +211,9 @@ impl<T> VecDeque<T> {
/// If so, this function never panics.
#[inline]
unsafe fn copy_slice(&mut self, src: &[T]) {
/// This is guaranteed by `RawVec`.
debug_assert!(self.capacity() <= isize::MAX as usize);

let expected_new_len = self.len() + src.len();
debug_assert!(self.capacity() >= expected_new_len);

Expand Down

0 comments on commit 21d2a6c

Please sign in to comment.