Previously there was a bug where the memory cleanup for multiple pass-by-reference arguments would end up on the same line (note: the cleanup code is only generated if the function in question returns a rust-owned object). This PR fixes it.
This would generate the following bug in Kotlin (buggy line commented):
fun testing(a: UByteArray, b: UByteArray): RustOwnedBytes {
val (aMem, aSlice) = PrimitiveArrayTools.native(a)
val (bMem, bSlice) = PrimitiveArrayTools.native(b)
val returnVal = lib.ExampleStruct_testing(handle, aSlice, bSlice);
val selfEdges: List<Any> = listOf()
val handle = returnVal
val returnOpaque = RustOwnedBytes(handle, selfEdges)
CLEANER.register(returnOpaque, RustOwnedBytes.RustOwnedBytesCleaner(handle, RustOwnedBytes.lib));
aMem.close()bMem.close() // THIS IS THE BUG THE CLEANUP LINES ARE ON THE SAME LINE
return returnOpaque
}
Previously there was a bug where the memory cleanup for multiple pass-by-reference arguments would end up on the same line (note: the cleanup code is only generated if the function in question returns a rust-owned object). This PR fixes it.
Example of bug: Rust
This would generate the following bug in Kotlin (buggy line commented):