Skip to content

Commit 1dba4b0

Browse files
committed
fix ICE from debug output by using kind_ty in dumping closure
Also, make `-Zverbose` dump all info about constants.
1 parent bec0902 commit 1dba4b0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/librustc/ty/print/pretty.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ pub trait PrettyPrinter<'tcx>:
689689
if self.tcx().sess.verbose() {
690690
p!(write(
691691
" closure_kind_ty={:?} closure_sig_ty={:?}",
692-
substs.as_closure().kind(did, self.tcx()),
692+
substs.as_closure().kind_ty(did, self.tcx()),
693693
substs.as_closure().sig_ty(did, self.tcx())
694694
));
695695
}
@@ -698,7 +698,9 @@ pub trait PrettyPrinter<'tcx>:
698698
},
699699
ty::Array(ty, sz) => {
700700
p!(write("["), print(ty), write("; "));
701-
if let ConstValue::Unevaluated(..) = sz.val {
701+
if self.tcx().sess.verbose() {
702+
p!(write("{:?}", sz));
703+
} else if let ConstValue::Unevaluated(..) = sz.val {
702704
// do not try to evalute unevaluated constants. If we are const evaluating an
703705
// array length anon const, rustc will (with debug assertions) print the
704706
// constant's path. Which will end up here again.
@@ -855,6 +857,11 @@ pub trait PrettyPrinter<'tcx>:
855857
) -> Result<Self::Const, Self::Error> {
856858
define_scoped_cx!(self);
857859

860+
if self.tcx().sess.verbose() {
861+
p!(write("Const({:?}: {:?})", ct.val, ct.ty));
862+
return Ok(self);
863+
}
864+
858865
let u8 = self.tcx().types.u8;
859866
if let ty::FnDef(did, substs) = ct.ty.kind {
860867
p!(print_value_path(did, substs));

0 commit comments

Comments
 (0)