diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 58315cb74f0a1..dca749043afa1 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -255,7 +255,10 @@ impl Clone for MaybeUninit { #[stable(feature = "maybe_uninit_debug", since = "1.41.0")] impl fmt::Debug for MaybeUninit { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.pad(type_name::()) + let full_name = type_name::(); + // NB: this needs to be adjusted if `MaybeUninit` moves modules + let short_name = full_name.split_once("mem::maybe_uninit::").unwrap().1; + f.pad(short_name) } }