Skip to content

Commit b24ff57

Browse files
Don't panic when formatting without Program
1 parent 260bf15 commit b24ff57

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

chalk-ir/src/debug.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,13 @@ impl<I: Interner> Debug for QuantifiedWhereClauses<I> {
152152

153153
impl<I: Interner> Debug for ProjectionTy<I> {
154154
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> {
155-
I::debug_projection_ty(self, fmt).unwrap_or_else(|| {
156-
unimplemented!("cannot format ProjectionTy without setting Program in tls")
157-
})
155+
I::debug_projection_ty(self, fmt).unwrap_or_else(|| fmt.write_str("<ProjectionTy>"))
158156
}
159157
}
160158

161159
impl<I: Interner> Debug for OpaqueTy<I> {
162160
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> {
163-
I::debug_opaque_ty(self, fmt).unwrap_or_else(|| {
164-
unimplemented!("cannot format OpaqueTy without setting Program in tls")
165-
})
161+
I::debug_opaque_ty(self, fmt).unwrap_or_else(|| fmt.write_str("<OpaqueTy>"))
166162
}
167163
}
168164

0 commit comments

Comments
 (0)