From: Tim Diekmann <21277928+TimDiekmann@users.noreply.github.com> Date: Wed, 19 Aug 2020 23:01:46 +0000 (+0200) Subject: Add debug assertion for equal alignment in RawVec X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=303ee3fd8382947d0da7a728c728bc672dc0f7be;p=rust.git Add debug assertion for equal alignment in RawVec --- diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs index e00cb361c00..dafbb0acd11 100644 --- a/library/alloc/src/raw_vec.rs +++ b/library/alloc/src/raw_vec.rs @@ -494,6 +494,7 @@ fn finish_grow( 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)