Hand-implement impl Debug for NumBuffer to avoid constraining T or printing MaybeUninit

The derived implementation requires `T: Debug`, and doesn't need to.
This commit is contained in:
Josh Triplett
2026-05-02 19:40:07 -07:00
parent a3e96d8cb8
commit df8a13ecf4
+7 -1
View File
@@ -35,7 +35,6 @@ impl_NumBufferTrait! {
/// A buffer wrapper of which the internal size is based on the maximum
/// number of digits the associated integer can have.
#[unstable(feature = "int_format_into", issue = "138215")]
#[derive(Debug)]
pub struct NumBuffer<T: NumBufferTrait> {
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
pub(crate) buf: [MaybeUninit<u8>; 40],
@@ -43,6 +42,13 @@ pub struct NumBuffer<T: NumBufferTrait> {
phantom: core::marker::PhantomData<T>,
}
#[unstable(feature = "int_format_into", issue = "138215")]
impl<T: NumBufferTrait> core::fmt::Debug for NumBuffer<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("NumBuffer").finish()
}
}
#[unstable(feature = "int_format_into", issue = "138215")]
impl<T: NumBufferTrait> NumBuffer<T> {
/// Initializes internal buffer.