Subject: Re: [PATCH 4/7] xdiff: make fields of xrecord_t Rust friendly

From: Taylor Blau <[email-masked]>
Date: Thu, 17 Jul 2025 18:46:56 -0400

On Thu, Jul 17, 2025 at 08:32:21PM +0000, Ezekiel Newren via GitGitGadget wrote:
> From: Ezekiel Newren <[email-masked]>
>
> A few commits ago, we added definitions for Rust primitive types,
> to facilitate interoperability between C and Rust. Switch a
> few variables to use these types. Which, for now, will
> require adding some casts.

Hmm, interesting. I am not super familiar with how people typically
handle interoperability between C and Rust, but having to change types
on the C side to make it work with Rust is a bit surprising to me.

I would have expected that the Rust side would have declared its types
using libc::c_int, libc::size_t, and so on. I think I have a vague
preference towards putting the burden of casting on the Rust side, but,
again, I am not super familiar with how transitions like these are
typically approached.

> ---
>  xdiff/xdiffi.c    |  8 ++++----
>  xdiff/xemit.c     |  2 +-
>  xdiff/xmerge.c    | 14 +++++++-------
>  xdiff/xpatience.c |  2 +-
>  xdiff/xprepare.c  |  6 +++---
>  xdiff/xtypes.h    |  6 +++---
>  xdiff/xutils.c    |  4 ++--
>  7 files changed, 21 insertions(+), 21 deletions(-)

The rest of the patch looks good to me, assuming that the burden of
casting is placed on the C side.

Thanks,
Taylor