From 4f695895d0fcd26f09e2934218d9f9351e36e63b Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Wed, 2 Feb 2022 09:14:24 +0100 Subject: [PATCH] Fix theoretical UB while transmuting Arc (#588) --- src/column_family.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/column_family.rs b/src/column_family.rs index f39e895..4cd5d30 100644 --- a/src/column_family.rs +++ b/src/column_family.rs @@ -71,7 +71,7 @@ impl UnboundColumnFamily { pub(crate) fn bound_column_family<'a>(self: Arc) -> Arc> { // SAFETY: the new BoundColumnFamily here just adding lifetime, // so that column family handle won't outlive db. - unsafe { std::mem::transmute(self) } + unsafe { Arc::from_raw(Arc::into_raw(self).cast()) } } }