Skip to content

Commit 0fdf39f

Browse files
committed
debug-assert
1 parent 16c8e4d commit 0fdf39f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/arrayvec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
645645
/// Safety:
646646
/// This operation is safe if and only if length equals capacity.
647647
pub unsafe fn into_inner_unchecked(self) -> [T; CAP] {
648+
debug_assert_eq!(self.len(), self.capacity());
648649
let self_ = ManuallyDrop::new(self);
649650
let array = ptr::read(self_.as_ptr() as *const [T; CAP]);
650651
array

0 commit comments

Comments
 (0)