summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-03-30 22:58:28 +0200
committerHampusM <hampus@hampusmat.com>2025-03-30 22:58:28 +0200
commit88414e46f5a8c127d7a8e5613276913f2b1ad141 (patch)
tree9f144ef2fa3a3ce31cb7474f12aef3f0b0e89b52
parentf5a482faa1e4302e879533b9ce4e5a956af00cee (diff)
fix: add missing FieldOwned Drop impl
-rw-r--r--src/lib.rs10
-rw-r--r--src/util.rs5
2 files changed, 15 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index f482b5c..6282a8b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -826,6 +826,16 @@ impl FieldOwned<'_>
}
}
+impl Drop for FieldOwned<'_>
+{
+ fn drop(&mut self)
+ {
+ unsafe {
+ (self.field_metadata.drop_in_place)(self.bytes.as_ptr());
+ }
+ }
+}
+
#[derive(Debug)]
pub struct FieldSliceMut<'mv>
{
diff --git a/src/util.rs b/src/util.rs
index 22f5fb7..ba60395 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -68,6 +68,11 @@ impl AnonUnique
{
unsafe { std::slice::from_raw_parts(self.ptr.as_ptr(), self.layout.size()) }
}
+
+ pub fn as_ptr(&self) -> NonNull<MaybeUninit<u8>>
+ {
+ self.ptr
+ }
}
impl Drop for AnonUnique