Re: [PATCH v8 10/14] rust: alloc: add `Box::into_pin`

From: Andreas Hindborg
Date: Fri Feb 21 2025 - 04:32:39 EST


"Benno Lossin" <benno.lossin@xxxxxxxxx> writes:

> On 18.02.25 14:27, Andreas Hindborg wrote:
>> Add an associated function to convert a `Box<T>` into a `Pin<Box<T>>`.
>
> Why don't you use `into()` directly where you need it? Do you want the
> function call to be more descriptive?
> (To be clear, I'm not against the addition, just wanting to check if our
> motivation is the same)

Yes, I prefer the explicit name in a line like this:

// SAFETY: We called `Box::into_raw` when we queued the timer.
let tbox = ManuallyDrop::new(Box::into_pin(unsafe { Box::<T, A>::from_raw(data_ptr) }));


Best regards,
Andreas Hindborg