Skip to content

Commit 1f1defc

Browse files
committed
Auto merge of #99099 - Stargateur:phantomdata_debug, r=joshtriplett
Add T to PhantomData impl Debug This add debug information for `PhantomData`, I believe it's make sense to add this to debug impl of `PhantomData` since `T` is what define what is the `PhantomData` just write `"PhantomData"` is not very useful for debugging. Alternative: * `PhantomData::<{}>` * `PhantomData { t: "str_type" }` `@rustbot` label +T-libs-api -T-libs
2 parents f83e026 + eac1e30 commit 1f1defc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: library/core/src/fmt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2610,7 +2610,7 @@ impl Debug for () {
26102610
#[stable(feature = "rust1", since = "1.0.0")]
26112611
impl<T: ?Sized> Debug for PhantomData<T> {
26122612
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
2613-
f.debug_struct("PhantomData").finish()
2613+
write!(f, "PhantomData<{}>", crate::any::type_name::<T>())
26142614
}
26152615
}
26162616

0 commit comments

Comments
 (0)