[PATCH] rust: pin-init: remove `pin_init_internal` from rustdoc

From: Gary Guo

Date: Tue Dec 01 2026 - 09:51:05 EST


Currently, `pin_init_internal` is rendered in rustdoc but it contains no
documentation (everything is documented in the `pin-init` crate instead).
Thus remove it.

Due to the way rustc resolves things (which rustdoc inherits), direct
mention of `pin_init::pin_init` is always resolved to the original crate
that defines it (re-exports are transparent), unless the re-export is in
the local crate which is special-cased in rustdoc. Thus update the mentions
of `init.rs` in kernel crate to use relative paths instead, so they
correctly point to the `pin_init` crate and not the `pin_init_internal`
one.

Also note that this change will cause `kernel::prelude` re-export of
pin-init macros to lose their hyperlink (which I think is better than
linking to `pin_init_internal`).

Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
---
rust/Makefile | 9 +--------
rust/kernel/init.rs | 6 +++---
2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/rust/Makefile b/rust/Makefile
index 0165626decbe..55108ce4dc88 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -263,18 +263,11 @@ rustdoc-ffi: private is-kernel-object := y
rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE
+$(call if_changed,rustdoc)

-rustdoc-pin_init_internal: private rustdoc_host = yes
-rustdoc-pin_init_internal: private rustc_target_flags = $(pin_init_internal-flags) \
- --extern proc_macro --crate-type proc-macro
-rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs \
- rustdoc-clean rustdoc-proc_macro2 rustdoc-quote rustdoc-syn FORCE
- +$(call if_changed,rustdoc)
-
rustdoc-pin_init: private rustdoc_host = yes
rustdoc-pin_init: private rustc_target_flags = $(pin_init-flags) \
--extern pin_init_internal=$(objtree)/$(obj)/$(libpin_init_internal_name) \
--extern alloc --cfg feature=\"alloc\"
-rustdoc-pin_init: $(src)/pin-init/src/lib.rs rustdoc-pin_init_internal \
+rustdoc-pin_init: $(src)/pin-init/src/lib.rs \
rustdoc-macros FORCE
+$(call if_changed,rustdoc)

diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index a8df7b6a2749..fcd4270542e3 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -23,7 +23,7 @@
//!
//! [`Opaque<T>`]: crate::types::Opaque
//! [`Opaque::ffi_init`]: crate::types::Opaque::ffi_init
-//! [`pin_init!`]: pin_init::pin_init
+//! [`pin_init!`]: ../../pin_init/macro.pin_init.html
//!
//! # Examples
//!
@@ -218,7 +218,7 @@ fn init<E>(init: impl Init<T, E>, flags: Flags) -> error::Result<Self>
/// ```
///
/// [`Infallible`]: core::convert::Infallible
-/// [`init!`]: pin_init::init
+/// [`init!`]: ../pin_init/macro.init.html
/// [`try_pin_init!`]: crate::try_pin_init!
/// [`Error`]: crate::error::Error
#[macro_export]
@@ -271,7 +271,7 @@ macro_rules! try_init {
/// ```
///
/// [`Infallible`]: core::convert::Infallible
-/// [`pin_init!`]: pin_init::pin_init
+/// [`pin_init!`]: ../pin_init/macro.pin_init.html
/// [`Error`]: crate::error::Error
#[macro_export]
macro_rules! try_pin_init {

---
base-commit: 246f6b0262bae1c4a8145804713c0a338f907bc4
change-id: 20261201-dev-init-doc-47f64c92e22e

Best regards,
--
Gary Guo <gary@xxxxxxxxxxx>