From f4623d12058566e2f5fcc30d26570e7250c26e23 Mon Sep 17 00:00:00 2001 From: Janis Date: Wed, 2 Jul 2025 19:18:41 +0200 Subject: [PATCH] fixed can_transmute/SmallBox::is_inline --- src/smallbox.rs | 3 ++- src/util.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/smallbox.rs b/src/smallbox.rs index 8a6e678..1531e38 100644 --- a/src/smallbox.rs +++ b/src/smallbox.rs @@ -137,7 +137,8 @@ impl SmallBox { // the value can be stored inline iff the size of T is equal or // smaller than the size of the boxed type and the alignment of the // boxed type is an integer multiple of the alignment of T - crate::can_transmute::>, T>() + (size_of::>>() >= size_of::>()) + & (align_of::>>() >= align_of::>()) } pub fn new(value: T) -> Self { diff --git a/src/util.rs b/src/util.rs index bcfc2c4..0570972 100644 --- a/src/util.rs +++ b/src/util.rs @@ -44,5 +44,5 @@ pub const fn can_transmute() -> bool { use core::mem::{align_of, size_of}; // We can transmute `A` to `B` iff `A` and `B` have the same size and the // alignment of `A` is greater than or equal to the alignment of `B`. - size_of::() <= size_of::() && align_of::() >= align_of::() + (size_of::() == size_of::()) & (align_of::() >= align_of::()) }