diff options
author | HampusM <hampus@hampusmat.com> | 2025-03-30 22:58:28 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2025-03-30 22:58:28 +0200 |
commit | 88414e46f5a8c127d7a8e5613276913f2b1ad141 (patch) | |
tree | 9f144ef2fa3a3ce31cb7474f12aef3f0b0e89b52 | |
parent | f5a482faa1e4302e879533b9ce4e5a956af00cee (diff) |
fix: add missing FieldOwned Drop impl
-rw-r--r-- | src/lib.rs | 10 | ||||
-rw-r--r-- | src/util.rs | 5 |
2 files changed, 15 insertions, 0 deletions
@@ -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 |