From 93f5097970fb18b84aad2e73f72cc9cb703ba2b3 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 26 Apr 2023 18:32:06 +0300 Subject: [PATCH] #79 drop implemented --- src/ctors.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ctors.rs b/src/ctors.rs index de97c74..a249581 100644 --- a/src/ctors.rs +++ b/src/ctors.rs @@ -42,6 +42,16 @@ impl Map { } } +impl Drop for Map { + fn drop(&mut self) { + for i in 0..self.next { + unsafe { + self.pairs[i].assume_init_drop(); + } + } + } +} + #[cfg(test)] use anyhow::Result; @@ -66,7 +76,6 @@ fn drops_correctly() -> Result<()> { } #[test] -#[ignore] fn drops_keys() { use std::rc::Rc; let mut m: Map, (), 8> = Map::new(); @@ -77,7 +86,6 @@ fn drops_keys() { } #[test] -#[ignore] fn drops_values() { use std::rc::Rc; let mut m: Map<(), Rc<()>, 8> = Map::new();