Subject: linux-next: manual merge of the rust tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 17 Mar 2025 21:20:47 +1100

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

  rust/kernel/init.rs
  rust/pin-init/src/macros.rs

between commits:

  df27cef15360 ("rust: init: fix `Zeroable` implementation for `Option<NonNull<T>>` and `Option<KBox<T>>`")
  6933c1067fe6 ("rust: init: add missing newline to pr_info! calls")

from Linus' tree and commit:

  fbf8fb328d1b ("rust: move pin-init API into its own directory")

and following ones from the rust tree.

I fixed it up (I just used the latter version and applied the following
patch) and can carry the fix as necessary. This is now fixed as far as
linux-next is concerned, but any non trivial conflicts should be
mentioned to your upstream maintainer when your tree is submitted for
merging.  You may also want to consider cooperating with the maintainer
of the conflicting tree to minimise any particularly complex conflicts.

More (or less) may be needed :-(

From: Stephen Rothwell <[email-masked]>
Date: Mon, 17 Mar 2025 21:16:57 +1100
Subject: [PATCH] fix up for "rust: init: fix `Zeroable` implementation for
 `Option<NonNull<T>>` and `Option<KBox<T>>`"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 rust/pin-init/src/lib.rs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index f36b8f8e8730..9cd822388ba2 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -1446,16 +1446,14 @@ macro_rules! impl_zeroable {
     // SAFETY: `T: Zeroable` and `UnsafeCell` is `repr(transparent)`.
     {<T: ?Sized + Zeroable>} UnsafeCell<T>,
 
-    // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee).
+    // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee:
+    // https://doc.rust-lang.org/stable/std/option/index.html#representation).
     Option<NonZeroU8>, Option<NonZeroU16>, Option<NonZeroU32>, Option<NonZeroU64>,
     Option<NonZeroU128>, Option<NonZeroUsize>,
     Option<NonZeroI8>, Option<NonZeroI16>, Option<NonZeroI32>, Option<NonZeroI64>,
     Option<NonZeroI128>, Option<NonZeroIsize>,
 
-    // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee).
-    //
-    // In this case we are allowed to use `T: ?Sized`, since all zeros is the `None` variant.
-    {<T: ?Sized>} Option<NonNull<T>>,
+    {<T>} Option<NonNull<T>>,
 
     // SAFETY: `null` pointer is valid.
     //
-- 
2.45.2

-- 
Cheers,
Stephen Rothwell