From 62856006ab67c4c1c09fd968d2bcea56c64b1a68 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Thu, 13 Aug 2026 22:57:38 -0400 Subject: [PATCH 1/2] Impl `Debug` for `SendSyncNonNull` regardless of pointee --- src/send_sync_non_null.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/send_sync_non_null.rs b/src/send_sync_non_null.rs index 57a4ea68e..64c1c3eee 100644 --- a/src/send_sync_non_null.rs +++ b/src/send_sync_non_null.rs @@ -1,3 +1,4 @@ +use std::fmt; use std::ptr::NonNull; /// A [`NonNull`] that is [`Send`]` + `[`Sync`]. @@ -17,7 +18,6 @@ use std::ptr::NonNull; /// /// though these are `unsafe` due to the raw pointers /// and potential [`Self::cast`] called in between. -#[derive(Debug)] #[repr(transparent)] pub struct SendSyncNonNull(NonNull); @@ -90,3 +90,10 @@ impl SendSyncNonNull { unsafe { Box::from_raw(ptr) } } } + +impl fmt::Debug for SendSyncNonNull { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.0, f) + } +} From b0e99b569e3d65d100f174a065102fe9780fa27b Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Sat, 19 Sep 2026 10:52:36 -0400 Subject: [PATCH 2/2] Add comment explaining why no `derive` --- src/send_sync_non_null.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/send_sync_non_null.rs b/src/send_sync_non_null.rs index 64c1c3eee..8f193bd2c 100644 --- a/src/send_sync_non_null.rs +++ b/src/send_sync_non_null.rs @@ -91,6 +91,7 @@ impl SendSyncNonNull { } } +// Don't `derive` in order to avoid `T: Debug` bound impl fmt::Debug for SendSyncNonNull { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {