-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace transmute to box from/into #503
base: main
Are you sure you want to change the base?
Conversation
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. |
ec245d2
to
626c0c0
Compare
daa3dbc
to
8705065
Compare
I'm sure there's no problem now |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
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