Thread (12 messages) 12 messages, 6 authors, 2026-03-07

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

From: "Gary Guo" <gary@garyguo.net>
Date: 2026-03-02 19:42:49
Also in: lkml

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:
quoted
From: Gary Guo <gary@garyguo.net>

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@garyguo.net>
---
 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
quoted
 //
 // Stable since Rust 1.80.0.
 #![feature(slice_flatten)]
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help