Skip to content

Commit cc7c5ad

Browse files
committed
Ty Debug now prints id and kind
1 parent 24bece8 commit cc7c5ad

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
@@ -1,9 +1,16 @@
11
use super::{mir::Mutability, mir::Safety, with, AllocId, DefId};
22
use crate::rustc_internal::Opaque;
3+
use std::fmt::{self, Debug, Formatter};
34

4-
#[derive(Copy, Clone, Debug)]
5+
#[derive(Copy, Clone)]
56
pub struct Ty(pub usize);
67

8+
impl Debug for Ty {
9+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
10+
f.debug_struct("Ty").field("id", &self.0).field("kind", &self.kind()).finish()
11+
}
12+
}
13+
714
impl Ty {
815
pub fn kind(&self) -> TyKind {
916
with(|context| context.ty_kind(*self))

0 commit comments

Comments
 (0)