Skip to content

Commit 3b51291

Browse files
authored
Rollup merge of rust-lang#115605 - ouz-a:smir_better_debug, r=oli-obk
Better Debug for `Ty` in smir Similar to what I did here rust-lang#115534. r? `@oli-obk`
2 parents 33602e3 + cc7c5ad commit 3b51291

File tree

1 file changed

+8
-1
lines changed
  • compiler/rustc_smir/src/stable_mir

1 file changed

+8
-1
lines changed

compiler/rustc_smir/src/stable_mir/ty.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ use super::{
44
with, AllocId, DefId,
55
};
66
use crate::rustc_internal::Opaque;
7+
use std::fmt::{self, Debug, Formatter};
78

8-
#[derive(Copy, Clone, Debug)]
9+
#[derive(Copy, Clone)]
910
pub struct Ty(pub usize);
1011

12+
impl Debug for Ty {
13+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
14+
f.debug_struct("Ty").field("id", &self.0).field("kind", &self.kind()).finish()
15+
}
16+
}
17+
1118
impl Ty {
1219
pub fn kind(&self) -> TyKind {
1320
with(|context| context.ty_kind(*self))

0 commit comments

Comments
 (0)