From 2d524b1cd90fc8cead0c7da50369e49f6915148e Mon Sep 17 00:00:00 2001 From: Lukas Bergdoll Date: Fri, 18 Aug 2023 18:37:34 +0200 Subject: [PATCH] Fix IsFreeze trait --- src/lib.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ac49b9f..e3fbffc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -178,21 +178,16 @@ unsafe impl Freeze for *mut T {} unsafe impl Freeze for &T {} unsafe impl Freeze for &mut T {} -#[const_trait] trait IsFreeze { - fn value() -> bool; + const IS_FREEZE: bool; } impl const IsFreeze for T { - default fn value() -> bool { - false - } + default const IS_FREEZE: bool = false; } impl const IsFreeze for T { - fn value() -> bool { - true - } + const IS_FREEZE: bool = true; } #[must_use] @@ -201,7 +196,7 @@ const fn has_direct_interior_mutability() -> bool { // can have interior mutability it may alter itself during comparison in a way that must be // observed after the sort operation concludes. Otherwise a type like Mutex>> // could lead to double free. - !::value() + !T::IS_FREEZE } trait IsTrue {}