Skip to content

Commit

Permalink
Ty Debug now prints id and kind
Browse files Browse the repository at this point in the history
  • Loading branch information
ouz-a committed Sep 6, 2023
1 parent 24bece8 commit cc7c5ad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion compiler/rustc_smir/src/stable_mir/ty.rs
Original file line number Diff line number Diff line change
@@ -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))
Expand Down

0 comments on commit cc7c5ad

Please sign in to comment.