From e282375de4ba75c69f7d619fc33c6250f6caba18 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 6 Nov 2022 17:20:45 +0100 Subject: fix: allow declaring a concrete type as it's own interface --- macros/src/libs/intertrait_macros/gen_caster.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'macros/src/libs/intertrait_macros') diff --git a/macros/src/libs/intertrait_macros/gen_caster.rs b/macros/src/libs/intertrait_macros/gen_caster.rs index a703a62..a76bb52 100644 --- a/macros/src/libs/intertrait_macros/gen_caster.rs +++ b/macros/src/libs/intertrait_macros/gen_caster.rs @@ -32,46 +32,46 @@ pub fn generate_caster( let new_caster = if sync { quote! { - syrette::libs::intertrait::Caster::::new_sync( + syrette::libs::intertrait::Caster::<#dst_trait>::new_sync( |from| { let concrete = from .downcast::<#ty>() .map_err(|_| syrette::libs::intertrait::CasterError::CastBoxFailed)?; - Ok(concrete as Box) + Ok(concrete as Box<#dst_trait>) }, |from| { let concrete = from .downcast::<#ty>() .map_err(|_| syrette::libs::intertrait::CasterError::CastRcFailed)?; - Ok(concrete as std::rc::Rc) + Ok(concrete as std::rc::Rc<#dst_trait>) }, |from| { let concrete = from .downcast::<#ty>() .map_err(|_| syrette::libs::intertrait::CasterError::CastArcFailed)?; - Ok(concrete as std::sync::Arc) + Ok(concrete as std::sync::Arc<#dst_trait>) }, ) } } else { quote! { - syrette::libs::intertrait::Caster::::new( + syrette::libs::intertrait::Caster::<#dst_trait>::new( |from| { let concrete = from .downcast::<#ty>() .map_err(|_| syrette::libs::intertrait::CasterError::CastBoxFailed)?; - Ok(concrete as Box) + Ok(concrete as Box<#dst_trait>) }, |from| { let concrete = from .downcast::<#ty>() .map_err(|_| syrette::libs::intertrait::CasterError::CastRcFailed)?; - Ok(concrete as std::rc::Rc) + Ok(concrete as std::rc::Rc<#dst_trait>) }, ) } -- cgit v1.2.3-18-g5258