diff options
Diffstat (limited to 'engine-macros')
| -rw-r--r-- | engine-macros/src/reflection/field.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/engine-macros/src/reflection/field.rs b/engine-macros/src/reflection/field.rs index 8572875..7d4e301 100644 --- a/engine-macros/src/reflection/field.rs +++ b/engine-macros/src/reflection/field.rs @@ -1,4 +1,4 @@ -use quote::{quote, ToTokens}; +use quote::quote; use crate::reflection::visibility::generate as generate_visibility; @@ -29,9 +29,6 @@ pub fn generate( let field_byte_offset = (options.gen_get_byte_offset)(field); - // since std::any::type_name as const is not stable yet - let field_type_name = field_type.to_token_stream().to_string(); - let field_vis = options.field_vis_override.as_ref().unwrap_or(&field.vis); let field_reflection_vis = generate_visibility(field_vis, &engine_crate_path); @@ -43,7 +40,9 @@ pub fn generate( layout: std::alloc::Layout::new::<#field_type>(), byte_offset: #field_byte_offset, type_id: std::any::TypeId::of::<#field_type>(), - type_name: #field_type_name, + get_type_name: #engine_crate_path::reflection::FnWithDebug::new(|| { + std::any::type_name::<#field_type>() + }), get_type: #engine_crate_path::reflection::FnWithDebug::new(|| { struct SpecializationTarget<Field>(std::marker::PhantomData<Field>); |
