Re: [PATCH v3 1/2] rust: kernel: add `drop_contents` to `BoxExt`

From: Alice Ryhl
Date: Mon Aug 05 2024 - 04:44:34 EST


On Sun, Aug 4, 2024 at 1:22 AM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> On 8/3/24 4:16 PM, Benno Lossin wrote:
> > Sometimes (see [1]) it is necessary to drop the value inside of a
> > `Box<T>`, but retain the allocation. For example to reuse the allocation
> > in the future.
> > Introduce a new function `drop_contents` that turns a `Box<T>` into
> > `Box<MaybeUninit<T>>` by dropping the value.
>
> Is this (and the stuff in patch 2) used somewhere? Otherwise, I think it
> would probably make sense to base this work on top of my allocator work.

Yes, please see the red/black tree.
https://lore.kernel.org/rust-for-linux/20240727-b4-rbtree-v8-0-951600ada434@xxxxxxxxxx/

Alice