diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 590e82357fb71..2bf40490e7819 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -520,6 +520,7 @@ impl RawVec { Layout::array::(cap).map_err(|_| CapacityOverflow)? } }; + alloc_guard(new_layout.size())?; let memory = if let Some((ptr, old_layout)) = self.current_memory() { debug_assert_eq!(old_layout.align(), new_layout.align());