diff options
Diffstat (limited to 'ecs/src/system')
-rw-r--r-- | ecs/src/system/stateful.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs index 49fd3bf..56c9d4f 100644 --- a/ecs/src/system/stateful.rs +++ b/ecs/src/system/stateful.rs @@ -114,30 +114,26 @@ macro_rules! impl_system { run: Box::new(|data, world_data| { // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let data = unsafe { &*(data as *const dyn Any) }; + let data = unsafe { &*std::ptr::from_ref::<dyn Any>(data) }; let me = data.downcast_ref::<Self>().unwrap(); // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let world_data = unsafe { - &*(world_data as *const WorldData) - }; + let world_data = unsafe { &*std::ptr::from_ref(world_data) }; me.run(world_data); }), prepare: Box::new(|data, world_data| { // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let data = unsafe { &*(data as *const dyn Any) }; + let data = unsafe { &*std::ptr::from_ref::<dyn Any>(data) }; let me = data.downcast_ref::<Self>().unwrap(); // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let world_data = unsafe { - &*(world_data as *const WorldData) - }; + let world_data = unsafe { &*std::ptr::from_ref(world_data) }; me.prepare(world_data); }), |