I think the rewriting bug I thought this original solution had fixed (but didn't) is because of the propagation of the offset permission not taking into account that the original type is already an array type that can be offset (so it rewrites it with an extra []). Maybe the propagation upward should only go as far as the as_ptr call. WDYT?
Sounds plausible to me. And I think your proposed fix sounds good - the *mut T output of as_ptr might be OFFSET even when the *mut [T; N] input is not. So as_ptr should not propagate OFFSET from its output to its input.
Sounds plausible to me. And I think your proposed fix sounds good - the
*mut T
output ofas_ptr
might beOFFSET
even when the*mut [T; N]
input is not. Soas_ptr
should not propagateOFFSET
from its output to its input.Originally posted by @spernsteiner in https://github.com/immunant/c2rust/issues/883#issuecomment-1512055429