-
Notifications
You must be signed in to change notification settings - Fork 62
src/cdef_apply.rs: more cleanup
#738
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
Conversation
folkertdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is about as far as the cleanup of this file will go at the moment. More can be done when data structure fields become safe, but then cleaning up the code here should follow naturally from those changes.
| slice::from_raw_parts(&mut *src[0].offset(y_off + x_off as isize - 2), 2), | ||
| slice::from_raw_parts(src[0].offset(y_off + x_off as isize - 2), 2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that &mut something that c2rust inserts? it's not really needed and also unsound when that pointer is dangling (a dangling pointer would be sound if the slice length were 0). Not a problem in practice here but in general it seems odd to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat (it also looks extra weird since we didn't delete it as we partially cleaned it up/bitdepth deduplicated it). c2rust transpile sometimes has redundant &mut *s, and it also generates that kind of code when it really should generate addr_of_mut! to be sound (see immunant/c2rust#301).
builds on #733