Re: [PATCH v4 1/3] rust: ptr: add `KnownSize` trait to support DST size info extraction

From: Gary Guo

Date: Mon Mar 02 2026 - 14:43:03 EST


On Mon Mar 2, 2026 at 6:57 PM GMT, Benno Lossin wrote:
> On Mon Mar 2, 2026 at 5:42 PM CET, Gary Guo wrote:
>> From: Gary Guo <gary@xxxxxxxxxxx>
>>
>> Add a `KnownSize` trait which is used obtain a size from a raw pointer's
>> metadata. This makes it possible to obtain size information on a raw slice
>> pointer. This is similar to Rust `core::mem::size_of_val_raw` which is not
>> yet stable.
>>
>> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
>> ---
>> rust/kernel/lib.rs | 1 +
>> rust/kernel/ptr.rs | 27 ++++++++++++++++++++++++++-
>> 2 files changed, 27 insertions(+), 1 deletion(-)
>>
>> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
>> index 3da92f18f4ee..510cc7fe4961 100644
>> --- a/rust/kernel/lib.rs
>> +++ b/rust/kernel/lib.rs
>> @@ -20,6 +20,7 @@
>> #![feature(generic_nonzero)]
>> #![feature(inline_const)]
>> #![feature(pointer_is_aligned)]
>> +#![feature(slice_ptr_len)]
>
> Oh and this is also missing a stability comment.

I don't see anything missing here? This is in the same group as other features
that are stable in 1.79.

Best,
Gary

>
> Cheers,
> Benno
>
>> //
>> // Stable since Rust 1.80.0.
>> #![feature(slice_flatten)]