Skip to content

Commit 11118dc

Browse files
committed
add some better debugs
1 parent e340996 commit 11118dc

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
155155
.filter(|&&r| !skol_resolution_map.contains_key(r))
156156
.cloned()
157157
.next()
158-
.expect("no representative region");
158+
.unwrap_or_else(|| {
159+
bug!("no representative region for `{:?}` in `{:?}`",
160+
skol, regions)
161+
});
159162

160163
(skol, representative)
161164
})

src/librustc_typeck/astconv.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
12261226
None
12271227
}
12281228
});
1229-
self.ty_of_arg(a, expected_arg_ty)
1229+
1230+
let input_ty = self.ty_of_arg(a, expected_arg_ty);
1231+
debug!("ty_of_closure: i={} input_ty={:?} expected_arg_ty={:?}",
1232+
i, input_ty, expected_arg_ty);
1233+
1234+
input_ty
12301235
});
12311236

12321237
let expected_ret_ty = expected_sig.as_ref().map(|e| e.output());

src/librustc_typeck/check/closure.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
5151
body: &'gcx hir::Body,
5252
expected_sig: Option<ty::FnSig<'tcx>>)
5353
-> Ty<'tcx> {
54-
debug!("check_closure opt_kind={:?} expected_sig={:?}",
54+
debug!("check_closure(opt_kind={:?}, expected_sig={:?})",
5555
opt_kind,
5656
expected_sig);
5757

@@ -61,10 +61,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
6161
decl,
6262
Abi::RustCall,
6363
expected_sig);
64+
65+
debug!("check_closure: ty_of_closure returns {:?}", sig);
66+
6467
// `deduce_expectations_from_expected_type` introduces late-bound
6568
// lifetimes defined elsewhere, which we need to anonymize away.
6669
let sig = self.tcx.anonymize_late_bound_regions(&sig);
6770

71+
debug!("check_closure: anonymized sig={:?}", sig);
72+
6873
// Create type variables (for now) to represent the transformed
6974
// types of upvars. These will be unified during the upvar
7075
// inference phase (`upvar.rs`).
@@ -104,7 +109,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
104109
sig.abi
105110
));
106111

107-
debug!("closure for {:?} --> sig={:?} opt_kind={:?}",
112+
debug!("check_closure: expr_def_id={:?}, sig={:?}, opt_kind={:?}",
108113
expr_def_id,
109114
sig,
110115
opt_kind);

0 commit comments

Comments
 (0)