Subject: Re: [PATCH v5 10/13] xdiff: delete rchg aliasing

From: Junio C Hamano <[email-masked]>
Date: Wed, 24 Sep 2025 14:31:28 -0700

Ezekiel Newren <[email-masked]> writes:

> I have a question for everyone: Does preparing C code to be translated
> into Rust count as a valid reason for changing it? Provided that there
> is no violation of the Git style (or very small in some cases).
>
> If my intent was to keep this as C code forever I'd agree, but...

You'd agree that "I am preparing this for eventual rewrite" would be
a valid reason?  Or you are agreeing with something else?

> My
> other reason is that it more closely follows Rust paradigms. Creating
> multiple pointers to the same memory in Rust subverts the borrow
> checker's ability to keep track of who owns the memory.

Sure.  But looking at the use of rchg[12] in xdl_build_script(), if
they were "const char *", combined with the fact that they are local
and their addresses are never taken (to be leaked to our callers),
you wouldn't have much trouble with the current code, or would you
still have issues?