Add debug assertion for equal alignment in RawVec

This commit is contained in:
Tim Diekmann 2020-08-20 01:01:46 +02:00 committed by GitHub
parent 438c40efa1
commit 303ee3fd83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -494,6 +494,7 @@ where
alloc_guard(new_layout.size())?;
let memory = if let Some((ptr, old_layout)) = current_memory {
debug_assert_eq!(old_layout.align(), new_layout.align());
unsafe { alloc.grow(ptr, old_layout, new_layout) }
} else {
alloc.alloc(new_layout)