Skip to content

Commit

Permalink
Auto merge of #608 - Areredify:ptr_debug_print, r=jackh726,detrumi
Browse files Browse the repository at this point in the history
fix debug print of pointer types

Fixes confusing debug print of pointer types, previously `&'a T` it was printed as `Not<!0_0, T>` and `*const T` was printed as `Not<T>`, which was not ideal.
  • Loading branch information
bors committed Sep 14, 2020
2 parents 758e38b + 3434f66 commit 3ea88b7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions chalk-ir/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,22 @@ impl<I: Interner> Debug for TypeName<I> {
TypeName::OpaqueType(opaque_ty) => write!(fmt, "!{:?}", opaque_ty),
TypeName::Slice => write!(fmt, "{{slice}}"),
TypeName::FnDef(fn_def) => write!(fmt, "{:?}", fn_def),
TypeName::Raw(mutability) => write!(fmt, "{:?}", mutability),
TypeName::Ref(mutability) => write!(fmt, "{:?}", mutability),
TypeName::Ref(mutability) => write!(
fmt,
"{}",
match mutability {
Mutability::Mut => "{{&mut}}",
Mutability::Not => "{{&}}",
}
),
TypeName::Raw(mutability) => write!(
fmt,
"{}",
match mutability {
Mutability::Mut => "{{*mut}}",
Mutability::Not => "{{*const}}",
}
),
TypeName::Never => write!(fmt, "Never"),
TypeName::Array => write!(fmt, "{{array}}"),
TypeName::Closure(id) => write!(fmt, "{{closure:{:?}}}", id),
Expand Down

0 comments on commit 3ea88b7

Please sign in to comment.