diff options
| author | ouz-a <ouz.agz@gmail.com> | 2023-09-06 14:03:12 +0300 |
|---|---|---|
| committer | ouz-a <ouz.agz@gmail.com> | 2023-09-06 15:02:03 +0300 |
| commit | cc7c5ad20b5aa3ebaa12bbf62b48254e18609017 (patch) | |
| tree | 9d41344abb8b01a26051a4a97864fe332f943897 | |
| parent | 24bece8420cf28b12a4b11788346ac6913e23146 (diff) | |
| download | rust-cc7c5ad20b5aa3ebaa12bbf62b48254e18609017.tar.gz rust-cc7c5ad20b5aa3ebaa12bbf62b48254e18609017.zip | |
Ty Debug now prints id and kind
| -rw-r--r-- | compiler/rustc_smir/src/stable_mir/ty.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_smir/src/stable_mir/ty.rs b/compiler/rustc_smir/src/stable_mir/ty.rs index 1db6b1e3d28..37c6be39a64 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)) |
