mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-06 08:36:52 -04:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user