mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
rust: sync: atomic: Implement Debug for Atomic<Debug>
If `Atomic<T>` is `Debug` then it's a `debugfs::Writer`, therefore make it so since 1) debugfs needs to support `Atomic<T>` and 2) it's rather trivial to implement `Debug` for `Atomic<Debug>`. Tested-by: David Gow <davidgow@google.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Link: https://patch.msgid.link/20251022035324.70785-3-boqun.feng@gmail.com
This commit is contained in:
@@ -307,6 +307,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AtomicType + core::fmt::Debug> core::fmt::Debug for Atomic<T>
|
||||
where
|
||||
T::Repr: AtomicBasicOps,
|
||||
{
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
core::fmt::Debug::fmt(&self.load(Relaxed), f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AtomicType> Atomic<T>
|
||||
where
|
||||
T::Repr: AtomicExchangeOps,
|
||||
|
||||
Reference in New Issue
Block a user