[RFC PATCH 5/6] rust: pin-init: allow doctests to refer to the pin-init crate

From: Benno Lossin
Date: Tue Mar 04 2025 - 18:01:27 EST


The next commit will name the pin-init crate from proc macros via
`::pin_init`. For this to work within tests of the pin-init crate
itself, it needs to be able to refer to itself via that name. Thus add
the required code for the name to be available.

Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
rust/pin-init/src/lib.rs | 3 +++
1 file changed, 3 insertions(+)

diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index cb015b118283..356fc959bcb9 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -282,6 +282,9 @@
#[cfg(any(feature = "std", feature = "alloc"))]
pub use alloc::InPlaceInit;

+#[allow(unused_extern_crates)]
+extern crate self as pin_init;
+
/// Used to specify the pinning information of the fields of a struct.
///
/// This is somewhat similar in purpose as
--
2.48.1