Ty Debug now prints id and kind

This commit is contained in:
ouz-a 2023-09-06 14:03:12 +03:00
parent 24bece8420
commit cc7c5ad20b
1 changed files with 8 additions and 1 deletions

View File

@ -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))