Skip to content

Commit 43c61db

Browse files
committed
Fix cloning trait structs via native clone method
When cloning a trait struct, we need to reference the already-converted-to-struct value, not the original, integer, value.
1 parent db1a110 commit 43c61db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gen_type_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def map_type_with_info(self, ty_info, print_void, ret_arr_len, is_free, holds_re
297297
if not is_free:
298298
needs_full_clone = not is_free and (not ty_info.is_ptr and not holds_ref or ty_info.requires_clone == True) and ty_info.requires_clone != False
299299
if needs_full_clone and (ty_info.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns:
300-
base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(" + ty_info.var_name + ");"
300+
base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(&" + ty_info.var_name + "_conv);"
301301
else:
302302
base_conv = base_conv + self.consts.trait_struct_inc_refcnt(ty_info)
303303
if needs_full_clone:

0 commit comments

Comments
 (0)