Open noname0310 opened 1 month ago
The changes themselves seem good, but they may require some adjustments considering Rust 2024 compatibility.
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html
As noted in the pull request template, signatures are required for "every commit". Since this requirement has not been met, I'm unable to merge the pull request.
I'm sure there's no problem now
Summary
According to the rust documentation ,
std::mem::transmute
is a dangerous function that is very prone to creating undefined behavior and should only be used as a last resort:And all the transmute functions used so far in this project are simply being used to extend the lifetime of a boxed value. This scenario is common in FFI code, so there are already better functions than
std::mem::transmute
for this. For example, you can use the pairBox::into_raw
andBox::from_raw
.This pull request replaces all
std::mem::transmute
calls withBox::into_raw
andBox::from_raw
to make the code safer.Note