Skip to content

Commit

Permalink
Rollup merge of rust-lang#115605 - ouz-a:smir_better_debug, r=oli-obk
Browse files Browse the repository at this point in the history
Better Debug for `Ty` in smir

Similar to what I did here rust-lang#115534.

r? ``@oli-obk``
  • Loading branch information
matthiaskrgr authored Sep 6, 2023
2 parents 23537ce + cc7c5ad commit 9a901da
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
Expand Up @@ -4,10 +4,17 @@ use super::{
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 9a901da

Please sign in to comment.