]> git.lizzy.rs Git - rust.git/commitdiff
Add debug assertion for equal alignment in RawVec
authorTim Diekmann <21277928+TimDiekmann@users.noreply.github.com>
Wed, 19 Aug 2020 23:01:46 +0000 (01:01 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Aug 2020 23:01:46 +0000 (01:01 +0200)
library/alloc/src/raw_vec.rs

index e00cb361c0019f8400365ee51115f6fef44a98aa..dafbb0acd1186b2130d8e3468f16240f9193fcf8 100644 (file)
@@ -494,6 +494,7 @@ fn finish_grow<A>(
     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)