Skip to content

Commit 07515c2

Browse files
committed
Add explanation of the hack
1 parent 9a4bebe commit 07515c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/cw-schema/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ impl Identifier {
153153
T: ?Sized,
154154
{
155155
// Don't do this at home. I'm a professional.
156+
//
157+
// This is a hack based on the assumption that each type has will produce a unique monomorphized function.
158+
// Therefore each function has a distinct function pointer.
159+
//
160+
// The compiler _might_ break this assumption in the future.
156161
#[inline]
157162
fn type_id_of<T: ?Sized>() -> usize {
158163
type_id_of::<T> as usize

0 commit comments

Comments
 (0)