diff --git a/compiler/rustc_smir/src/stable_mir/ty.rs b/compiler/rustc_smir/src/stable_mir/ty.rs index 1db6b1e3d28eb..37c6be39a6410 100644 --- a/compiler/rustc_smir/src/stable_mir/ty.rs +++ b/compiler/rustc_smir/src/stable_mir/ty.rs @@ -1,9 +1,16 @@ use super::{mir::Mutability, mir::Safety, with, AllocId, DefId}; use crate::rustc_internal::Opaque; +use std::fmt::{self, Debug, Formatter}; -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone)] pub struct Ty(pub usize); +impl Debug for Ty { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.debug_struct("Ty").field("id", &self.0).field("kind", &self.kind()).finish() + } +} + impl Ty { pub fn kind(&self) -> TyKind { with(|context| context.ty_kind(*self))