Re: [PATCH v3 03/12] rust: xarray: add `contains_index` method
From: Andreas Hindborg
Date: Wed Feb 11 2026 - 02:32:09 EST
Tamir Duberstein <tamird@xxxxxxxxx> writes:
> On Mon, Feb 9, 2026 at 6:38 AM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>>
>> Add a convenience method `contains_index` to check whether an element
>> exists at a given index in the XArray. This method provides a more
>> ergonomic API compared to calling `get` and checking for `Some`.
>>
>> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
>
> As I said in v1 I'm -1 on this change. As gregkh would say: it's hard
> to review a new API without seeing its user.
I already gave you the user inline [1] and if you wish you can also see
it in a downstream tree [2]. Gary already explained why this is required
with the current implementation of the borrow checker [3].
Best regards,
Andreas Hindborg
[1] https://lore.kernel.org/r/87344gh2pk.fsf@xxxxxxxxx-host-address-is-not-set
[2] https://github.com/metaspace/linux/blob/aa43a6ecb68a785a90e167609aa57c5a0860d123/drivers/block/rnull/disk_storage.rs#L218
[3] https://lore.kernel.org/r/DFK801ZCI1GD.34GWJ10JZBBBF@xxxxxxxxxxx