Re: [PATCH v4 1/7] rust: alloc: implement `Borrow` and `BorrowMut` for `Vec`

From: Danilo Krummrich
Date: Wed Jun 18 2025 - 17:46:00 EST


On Mon, Jun 16, 2025 at 12:34:05PM +0900, Alexandre Courbot wrote:
> Implement `Borrow<[T]>` and `BorrowMut<[T]>` for `Vec<T>`. This allows
> `Vec<T>` to be used in generic APIs asking for types implementing those
> traits. `[T; N]` and `&mut [T]` also implement those traits allowing
> users to use either owned, borrowed and heap-owned values.
>
> The implementation leverages `as_slice` and `as_mut_slice`.
>
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>

Applied to alloc-next, thanks!