From 4ad0f20f90147b663e0b151ffcdb88ca62c60281 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 24 May 2025 17:24:46 +0200 Subject: fix(ecs): add ArrayVec Drop impl --- ecs/src/util/array_vec.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ecs') diff --git a/ecs/src/util/array_vec.rs b/ecs/src/util/array_vec.rs index 13a0349..a37b1f9 100644 --- a/ecs/src/util/array_vec.rs +++ b/ecs/src/util/array_vec.rs @@ -115,3 +115,17 @@ impl Default for ArrayVec } } } + +impl Drop for ArrayVec +{ + fn drop(&mut self) + { + for item in &mut self.items[..self.len] { + // SAFETY: The items from index 0 to the length index will always be + // initialized and satisfy all the invariants of the Item type. + unsafe { + item.assume_init_drop(); + } + } + } +} -- cgit v1.2.3-18-g5258