Skip to content

Commit df8a13e

Browse files
committed
Hand-implement impl Debug for NumBuffer to avoid constraining T or printing MaybeUninit
The derived implementation requires `T: Debug`, and doesn't need to.
1 parent a3e96d8 commit df8a13e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

library/core/src/fmt/num_buffer.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@ impl_NumBufferTrait! {
3535
/// A buffer wrapper of which the internal size is based on the maximum
3636
/// number of digits the associated integer can have.
3737
#[unstable(feature = "int_format_into", issue = "138215")]
38-
#[derive(Debug)]
3938
pub struct NumBuffer<T: NumBufferTrait> {
4039
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
4140
pub(crate) buf: [MaybeUninit<u8>; 40],
4241
// FIXME: Remove this field once we can actually use `T`.
4342
phantom: core::marker::PhantomData<T>,
4443
}
4544

45+
#[unstable(feature = "int_format_into", issue = "138215")]
46+
impl<T: NumBufferTrait> core::fmt::Debug for NumBuffer<T> {
47+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
48+
f.debug_struct("NumBuffer").finish()
49+
}
50+
}
51+
4652
#[unstable(feature = "int_format_into", issue = "138215")]
4753
impl<T: NumBufferTrait> NumBuffer<T> {
4854
/// Initializes internal buffer.

0 commit comments

Comments
 (0)