Conversation
folkertdev
left a comment
There was a problem hiding this comment.
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.
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.
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