about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Diekmann <21277928+TimDiekmann@users.noreply.github.com>2020-08-20 01:01:46 +0200
committerGitHub <noreply@github.com>2020-08-20 01:01:46 +0200
commit303ee3fd8382947d0da7a728c728bc672dc0f7be (patch)
treee449d80e65796620a3448a8d3ecdde6f8fcc2a84
parent438c40efa109d7a4d83efa066c19cb95dad9ed94 (diff)
downloadrust-303ee3fd8382947d0da7a728c728bc672dc0f7be.tar.gz
rust-303ee3fd8382947d0da7a728c728bc672dc0f7be.zip
Add debug assertion for equal alignment in RawVec
-rw-r--r--library/alloc/src/raw_vec.rs1
1 files changed, 1 insertions, 0 deletions
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 @@ 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)