diff --git a/src/arena.rs b/src/arena.rs index af3fba55dd..174c79b540 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -189,7 +189,8 @@ impl Arena { /// Adds a new value to the arena, returning a typed handle. pub fn append(&mut self, value: T) -> Handle { let position = self.data.len() + 1; - let index = unsafe { Index::new_unchecked(position as u32) }; + let index = + Index::new(position as u32).expect("Failed to append to Arena. Handle overflows"); self.data.push(value); Handle::new(index) }