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

From: Danilo Krummrich
Date: Mon Aug 05 2024 - 05:08:00 EST


On Mon, Aug 05, 2024 at 10:43:57AM +0200, Alice Ryhl wrote:
> 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/

Ok, unless preferred otherwise, I'll pick it up in the corresponding patches of
my allocator series then.

>
> Alice
>