add some better debugs

This commit is contained in:
Niko Matsakis 2017-09-28 13:39:43 -04:00
parent e340996ff5
commit 11118dcf19
3 changed files with 17 additions and 4 deletions

View file

@ -155,7 +155,10 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
.filter(|&&r| !skol_resolution_map.contains_key(r))
.cloned()
.next()
.expect("no representative region");
.unwrap_or_else(|| {
bug!("no representative region for `{:?}` in `{:?}`",
skol, regions)
});
(skol, representative)
})

View file

@ -1226,7 +1226,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
None
}
});
self.ty_of_arg(a, expected_arg_ty)
let input_ty = self.ty_of_arg(a, expected_arg_ty);
debug!("ty_of_closure: i={} input_ty={:?} expected_arg_ty={:?}",
i, input_ty, expected_arg_ty);
input_ty
});
let expected_ret_ty = expected_sig.as_ref().map(|e| e.output());

View file

@ -51,7 +51,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
body: &'gcx hir::Body,
expected_sig: Option<ty::FnSig<'tcx>>)
-> Ty<'tcx> {
debug!("check_closure opt_kind={:?} expected_sig={:?}",
debug!("check_closure(opt_kind={:?}, expected_sig={:?})",
opt_kind,
expected_sig);
@ -61,10 +61,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
decl,
Abi::RustCall,
expected_sig);
debug!("check_closure: ty_of_closure returns {:?}", sig);
// `deduce_expectations_from_expected_type` introduces late-bound
// lifetimes defined elsewhere, which we need to anonymize away.
let sig = self.tcx.anonymize_late_bound_regions(&sig);
debug!("check_closure: anonymized sig={:?}", sig);
// Create type variables (for now) to represent the transformed
// types of upvars. These will be unified during the upvar
// inference phase (`upvar.rs`).
@ -104,7 +109,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
sig.abi
));
debug!("closure for {:?} --> sig={:?} opt_kind={:?}",
debug!("check_closure: expr_def_id={:?}, sig={:?}, opt_kind={:?}",
expr_def_id,
sig,
opt_kind);