From a716d186e89728a5ccb4dedb23c7c7b921210e76 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 16 Aug 2024 22:24:01 -0700 Subject: [PATCH] Replace transmute with pointer cast --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5f1a729..8e90c2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -119,7 +119,6 @@ use core::fmt::{self, Debug}; #[cfg(not(no_const_type_id))] use core::hash::{Hash, Hasher}; use core::marker::PhantomData; -use core::mem; #[cfg(not(no_const_type_id))] #[derive(Copy, Clone)] @@ -217,6 +216,6 @@ where let phantom_data = PhantomData::; NonStaticAny::get_type_id(unsafe { - mem::transmute::<&dyn NonStaticAny, &(dyn NonStaticAny + 'static)>(&phantom_data) + &*(&phantom_data as *const dyn NonStaticAny as *const (dyn NonStaticAny + 'static)) }) }