[PATCH RFC 4/7] rust: pin-init: allow `dead_code` on projection structure
From: Alexandre Courbot
Date: Tue Dec 16 2025 - 00:18:54 EST
Projection structures are not necessarily (and often not) used in their
entirety. At the moment partial uses result in warnings about the unused
members.
Discard them by allowing `dead_code` on the projection structure
To: Benno Lossin <lossin@xxxxxxxxxx>
Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
---
Benno, please let me know if this looks good to you and I will send you
a Github PR for this.
---
rust/pin-init/src/macros.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/pin-init/src/macros.rs b/rust/pin-init/src/macros.rs
index 682c61a587a0..fe60e570c729 100644
--- a/rust/pin-init/src/macros.rs
+++ b/rust/pin-init/src/macros.rs
@@ -1004,6 +1004,7 @@ fn drop(&mut self) {
@not_pinned($($(#[$($attr:tt)*])* $fvis:vis $field:ident : $type:ty),* $(,)?),
) => {
$crate::macros::paste! {
+ #[allow(dead_code)]
#[doc(hidden)]
$vis struct [< $name Projection >] <'__pin, $($decl_generics)*> {
$($(#[$($p_attr)*])* $pvis $p_field : ::core::pin::Pin<&'__pin mut $p_type>,)*
--
2.52.0