We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c443cf commit 153a916Copy full SHA for 153a916
library/alloc/src/vec.rs
@@ -2947,6 +2947,8 @@ impl<T> IntoIter<T> {
2947
/// * `offset == 0` is always valid
2948
/// * `offset` must be positive
2949
unsafe fn into_vec_with_uninit_prefix(self, offset: isize) -> Vec<T> {
2950
+ debug_assert!(offset > 0);
2951
+ debug_assert!(offset as usize + self.len() <= self.cap);
2952
let dst = unsafe { self.buf.as_ptr().offset(offset) };
2953
if self.ptr != dst as *const _ {
2954
unsafe { ptr::copy(self.ptr, dst, self.len()) }
0 commit comments