Re: [PATCH v5 10/13] xdiff: delete rchg aliasing
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 24, 2025, 21:31 UTC
- Message-ID
- <xmqqikh7k05r.fsf@gitster.g>
- In-Reply-To
- <CAH=ZcbAcvoXJYPHE=mcZSqPLuUPxKcSs-vd307X7uXi+aG3evw@mail.gmail.com>
Ezekiel Newren <ezekielnewren@gmail.com> writes:
Show 5 quoted lines
> 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?