make interpreter type Debug impl independent of Ty debug impl

This commit is contained in:
Ralf Jung 2023-09-15 09:53:22 +02:00
parent 9cbc90c0ae
commit 06a76ab415
2 changed files with 17 additions and 4 deletions

View File

@ -136,7 +136,11 @@ fn p<'a, 'tcx, Prov: Provenance>(
impl<Prov: Provenance> std::fmt::Debug for ImmTy<'_, Prov> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ImmTy").field("imm", &self.imm).field("ty", &self.layout.ty).finish()
// Printing `layout` results in too much noise; just print a nice version of the type.
f.debug_struct("ImmTy")
.field("imm", &self.imm)
.field("ty", &format_args!("{}", self.layout.ty))
.finish()
}
}
@ -305,7 +309,11 @@ pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
impl<Prov: Provenance> std::fmt::Debug for OpTy<'_, Prov> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("OpTy").field("op", &self.op).field("ty", &self.layout.ty).finish()
// Printing `layout` results in too much noise; just print a nice version of the type.
f.debug_struct("OpTy")
.field("op", &self.op)
.field("ty", &format_args!("{}", self.layout.ty))
.finish()
}
}

View File

@ -117,9 +117,10 @@ pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
impl<Prov: Provenance> std::fmt::Debug for MPlaceTy<'_, Prov> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// Printing `layout` results in too much noise; just print a nice version of the type.
f.debug_struct("MPlaceTy")
.field("mplace", &self.mplace)
.field("ty", &self.layout.ty)
.field("ty", &format_args!("{}", self.layout.ty))
.finish()
}
}
@ -237,7 +238,11 @@ pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
impl<Prov: Provenance> std::fmt::Debug for PlaceTy<'_, Prov> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("PlaceTy").field("place", &self.place).field("ty", &self.layout.ty).finish()
// Printing `layout` results in too much noise; just print a nice version of the type.
f.debug_struct("PlaceTy")
.field("place", &self.place)
.field("ty", &format_args!("{}", self.layout.ty))
.finish()
}
}