wjones127 commented on code in PR #4232:
URL: https://github.com/apache/arrow-rs/pull/4232#discussion_r1201317777
##########
arrow/src/ffi_stream.rs:
##########
@@ -231,8 +227,7 @@ impl ExportedArrayStream {
let struct_array = StructArray::from(batch);
let array = FFI_ArrowArray::new(&struct_array.to_data());
- unsafe { std::ptr::copy(addr_of!(array), out, 1) };
- std::mem::forget(array);
+ unsafe { std::ptr::write_unaligned(out, array) };
Review Comment:
This is a good question. However, the docs for `write_unaligned` say that
`src` is guaranteed not to be dropped:
https://doc.rust-lang.org/std/ptr/fn.write_unaligned.html
Internally, it's calling `intrinsics::forget()`. So I think this is sound.
https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1447
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]