Skip to content

Commit

Permalink
fix ICE from debug output by using kind_ty in dumping closure
Browse files Browse the repository at this point in the history
Also, make `-Zverbose` dump all info about constants.
  • Loading branch information
nikomatsakis committed Oct 7, 2019
1 parent bec0902 commit 1dba4b0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/librustc/ty/print/pretty.rs
Expand Up @@ -689,7 +689,7 @@ pub trait PrettyPrinter<'tcx>:
if self.tcx().sess.verbose() {
p!(write(
" closure_kind_ty={:?} closure_sig_ty={:?}",
substs.as_closure().kind(did, self.tcx()),
substs.as_closure().kind_ty(did, self.tcx()),
substs.as_closure().sig_ty(did, self.tcx())
));
}
Expand All @@ -698,7 +698,9 @@ pub trait PrettyPrinter<'tcx>:
},
ty::Array(ty, sz) => {
p!(write("["), print(ty), write("; "));
if let ConstValue::Unevaluated(..) = sz.val {
if self.tcx().sess.verbose() {
p!(write("{:?}", sz));
} else if let ConstValue::Unevaluated(..) = sz.val {
// do not try to evalute unevaluated constants. If we are const evaluating an
// array length anon const, rustc will (with debug assertions) print the
// constant's path. Which will end up here again.
Expand Down Expand Up @@ -855,6 +857,11 @@ pub trait PrettyPrinter<'tcx>:
) -> Result<Self::Const, Self::Error> {
define_scoped_cx!(self);

if self.tcx().sess.verbose() {
p!(write("Const({:?}: {:?})", ct.val, ct.ty));
return Ok(self);
}

let u8 = self.tcx().types.u8;
if let ty::FnDef(did, substs) = ct.ty.kind {
p!(print_value_path(did, substs));
Expand Down

0 comments on commit 1dba4b0

Please sign in to comment.