debug-assert

This commit is contained in:
Conrad Ludgate
2021-05-30 20:34:17 +01:00
parent 16c8e4d40d
commit 0fdf39f15d
+1
View File
@@ -645,6 +645,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
/// Safety: /// Safety:
/// This operation is safe if and only if length equals capacity. /// This operation is safe if and only if length equals capacity.
pub unsafe fn into_inner_unchecked(self) -> [T; CAP] { pub unsafe fn into_inner_unchecked(self) -> [T; CAP] {
debug_assert_eq!(self.len(), self.capacity());
let self_ = ManuallyDrop::new(self); let self_ = ManuallyDrop::new(self);
let array = ptr::read(self_.as_ptr() as *const [T; CAP]); let array = ptr::read(self_.as_ptr() as *const [T; CAP]);
array array