Skip to content

Commit

Permalink
debug-assert
Browse files Browse the repository at this point in the history
  • Loading branch information
conradludgate committed May 30, 2021
1 parent 16c8e4d commit 0fdf39f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/arrayvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
/// Safety:
/// This operation is safe if and only if length equals capacity.
pub unsafe fn into_inner_unchecked(self) -> [T; CAP] {
debug_assert_eq!(self.len(), self.capacity());
let self_ = ManuallyDrop::new(self);
let array = ptr::read(self_.as_ptr() as *const [T; CAP]);
array
Expand Down

0 comments on commit 0fdf39f

Please sign in to comment.