Re: [PATCH] rust: vec: impl Default for Vec with any allocator
From: Benno Lossin
Date: Tue Jun 10 2025 - 07:04:18 EST
On Tue Jun 10, 2025 at 12:31 PM CEST, Alice Ryhl wrote:
> The implementation of Default is restricted to only work with kmalloc
> vectors for no good reason. This means I have to use
>
> mem::replace(&mut my_vec, KVVec::new())
>
> in Rust Binder instead of `mem::take(&mut my_vec)`. Thus, expand the
> impl of Default to work with any allocator including kvmalloc.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>
---
Cheers,
Benno
> ---
> rust/kernel/alloc/kvec.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)