From 07515c216bc856d1a691938465f3a38b0682d901 Mon Sep 17 00:00:00 2001 From: Aumetra Weisman Date: Tue, 27 Aug 2024 16:02:31 +0200 Subject: [PATCH] Add explanation of the hack --- packages/cw-schema/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/cw-schema/src/lib.rs b/packages/cw-schema/src/lib.rs index c1279807f..9757354cf 100644 --- a/packages/cw-schema/src/lib.rs +++ b/packages/cw-schema/src/lib.rs @@ -153,6 +153,11 @@ impl Identifier { T: ?Sized, { // Don't do this at home. I'm a professional. + // + // This is a hack based on the assumption that each type has will produce a unique monomorphized function. + // Therefore each function has a distinct function pointer. + // + // The compiler _might_ break this assumption in the future. #[inline] fn type_id_of() -> usize { type_id_of:: as usize