@@ -162,10 +162,12 @@ impl Callable {
162162        F :  ' static  + FnMut ( & [ & Variant ] )  -> R , 
163163        S :  meta:: AsArg < GString > , 
164164    { 
165+         #[ cfg( debug_assertions) ]  
165166        meta:: arg_into_owned!( name) ; 
166167
167168        Self :: from_fn_wrapper :: < F ,  R > ( FnWrapper  { 
168169            rust_function, 
170+             #[ cfg( debug_assertions) ]  
169171            name, 
170172            thread_id :  Some ( std:: thread:: current ( ) . id ( ) ) , 
171173            linked_obj_id :  None , 
@@ -187,10 +189,12 @@ impl Callable {
187189        F :  ' static  + FnMut ( & [ & Variant ] )  -> R , 
188190        S :  meta:: AsArg < GString > , 
189191    { 
192+         #[ cfg( debug_assertions) ]  
190193        meta:: arg_into_owned!( name) ; 
191194
192195        Self :: from_fn_wrapper :: < F ,  R > ( FnWrapper  { 
193196            rust_function, 
197+             #[ cfg( debug_assertions) ]  
194198            name, 
195199            thread_id :  Some ( std:: thread:: current ( ) . id ( ) ) , 
196200            linked_obj_id :  Some ( linked_object. instance_id ( ) ) , 
@@ -254,10 +258,12 @@ impl Callable {
254258        F :  FnMut ( & [ & Variant ] )  -> Variant , 
255259        Fc :  FnOnce ( & Callable )  -> R , 
256260    { 
261+         #[ cfg( debug_assertions) ]  
257262        meta:: arg_into_owned!( name) ; 
258263
259264        let  callable = Self :: from_fn_wrapper :: < F ,  Variant > ( FnWrapper  { 
260265            rust_function, 
266+             #[ cfg( debug_assertions) ]  
261267            name, 
262268            thread_id :  Some ( std:: thread:: current ( ) . id ( ) ) , 
263269            linked_obj_id :  None , 
@@ -292,10 +298,12 @@ impl Callable {
292298        F :  ' static  + Send  + Sync  + FnMut ( & [ & Variant ] )  -> R , 
293299        S :  meta:: AsArg < GString > , 
294300    { 
301+         #[ cfg( debug_assertions) ]  
295302        meta:: arg_into_owned!( name) ; 
296303
297304        Self :: from_fn_wrapper :: < F ,  R > ( FnWrapper  { 
298305            rust_function, 
306+             #[ cfg( debug_assertions) ]  
299307            name, 
300308            thread_id :  None , 
301309            linked_obj_id :  None , 
@@ -340,6 +348,7 @@ impl Callable {
340348            callable_userdata :  Box :: into_raw ( Box :: new ( userdata) )  as  * mut  std:: ffi:: c_void , 
341349            call_func :  Some ( rust_callable_call_fn :: < F ,  R > ) , 
342350            free_func :  Some ( rust_callable_destroy :: < FnWrapper < F > > ) , 
351+             #[ cfg( debug_assertions) ]  
343352            to_string_func :  Some ( rust_callable_to_string_named :: < F > ) , 
344353            is_valid_func :  Some ( rust_callable_is_valid) , 
345354            ..Self :: default_callable_custom_info ( ) 
@@ -446,13 +455,9 @@ impl Callable {
446455        InstanceId :: try_from_i64 ( id) 
447456    } 
448457
449-     crate :: declare_hash_u32_method! { 
450-         /// Returns the 32-bit hash value of this callable's object. 
451-          /// 
452-          /// _Godot equivalent: `hash`_ 
453-      } 
454- 
455-     #[ deprecated = "renamed to hash_u32" ]  
458+     /// Returns the 32-bit hash value of this callable's object. 
459+      /// 
460+      /// _Godot equivalent: `hash`_ 
456461     pub  fn  hash ( & self )  -> u32  { 
457462        self . as_inner ( ) . hash ( ) . try_into ( ) . unwrap ( ) 
458463    } 
@@ -608,6 +613,7 @@ mod custom_callable {
608613
609614    pub ( crate )  struct  FnWrapper < F >  { 
610615        pub ( super )  rust_function :  F , 
616+         #[ cfg( debug_assertions) ]  
611617        pub ( super )  name :  GString , 
612618
613619        /// `None` if the callable is multi-threaded ([`Callable::from_sync_fn`]). 
@@ -658,11 +664,14 @@ mod custom_callable {
658664    )  { 
659665        let  arg_refs:  & [ & Variant ]  = Variant :: borrow_ref_slice ( p_args,  p_argument_count as  usize ) ; 
660666
661-         let  name = { 
667+         #[ cfg( debug_assertions) ]  
668+         let  name = & { 
662669            let  c:  & C  = CallableUserdata :: inner_from_raw ( callable_userdata) ; 
663670            c. to_string ( ) 
664671        } ; 
665-         let  ctx = meta:: CallContext :: custom_callable ( name. as_str ( ) ) ; 
672+         #[ cfg( not( debug_assertions) ) ]  
673+         let  name = "<optimized out>" ; 
674+         let  ctx = meta:: CallContext :: custom_callable ( name) ; 
666675
667676        crate :: private:: handle_varcall_panic ( & ctx,  & mut  * r_error,  move  || { 
668677            // Get the RustCallable again inside closure so it doesn't have to be UnwindSafe. 
@@ -685,11 +694,14 @@ mod custom_callable {
685694    { 
686695        let  arg_refs:  & [ & Variant ]  = Variant :: borrow_ref_slice ( p_args,  p_argument_count as  usize ) ; 
687696
688-         let  name = { 
697+         #[ cfg( debug_assertions) ]  
698+         let  name = & { 
689699            let  w:  & FnWrapper < F >  = CallableUserdata :: inner_from_raw ( callable_userdata) ; 
690700            w. name . to_string ( ) 
691701        } ; 
692-         let  ctx = meta:: CallContext :: custom_callable ( name. as_str ( ) ) ; 
702+         #[ cfg( not( debug_assertions) ) ]  
703+         let  name = "<optimized out>" ; 
704+         let  ctx = meta:: CallContext :: custom_callable ( name) ; 
693705
694706        crate :: private:: handle_varcall_panic ( & ctx,  & mut  * r_error,  move  || { 
695707            // Get the FnWrapper again inside closure so the FnMut doesn't have to be UnwindSafe. 
@@ -698,12 +710,16 @@ mod custom_callable {
698710            if  w. thread_id 
699711                . is_some_and ( |tid| tid != std:: thread:: current ( ) . id ( ) ) 
700712            { 
713+                 #[ cfg( debug_assertions) ]  
714+                 let  name = & w. name ; 
715+                 #[ cfg( not( debug_assertions) ) ]  
716+                 let  name = "<optimized out>" ; 
701717                // NOTE: this panic is currently not propagated to the caller, but results in an error message and Nil return. 
702718                // See comments in itest callable_call() for details. 
703719                panic ! ( 
704720                    "Callable '{}' created with from_fn() must be called from the same thread it was created in.\n \  
705721                     If you need to call it from any thread, use from_sync_fn() instead (requires `experimental-threads` feature).", 
706-                     w . name
722+                     name
707723                ) ; 
708724            } 
709725
@@ -749,6 +765,7 @@ mod custom_callable {
749765        * r_is_valid = sys:: conv:: SYS_TRUE ; 
750766    } 
751767
768+     #[ cfg( debug_assertions) ]  
752769    pub  unsafe  extern  "C"  fn  rust_callable_to_string_named < F > ( 
753770        callable_userdata :  * mut  std:: ffi:: c_void , 
754771        r_is_valid :  * mut  sys:: GDExtensionBool , 
0 commit comments