Skip to content

Commit 303ee3f

Browse files
authored
Add debug assertion for equal alignment in RawVec
1 parent 438c40e commit 303ee3f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/alloc/src/raw_vec.rs

+1
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ where
494494
alloc_guard(new_layout.size())?;
495495

496496
let memory = if let Some((ptr, old_layout)) = current_memory {
497+
debug_assert_eq!(old_layout.align(), new_layout.align());
497498
unsafe { alloc.grow(ptr, old_layout, new_layout) }
498499
} else {
499500
alloc.alloc(new_layout)

0 commit comments

Comments
 (0)