Skip to content

Commit

Permalink
Add more debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino authored and nikomatsakis committed Dec 13, 2017
1 parent 688ab5a commit 4449240
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
body_id: ast::NodeId,
obligation: RegionObligation<'tcx>,
) {
debug!("register_region_obligation({:?}, {:?})", body_id, obligation);
debug!(
"register_region_obligation(body_id={:?}, obligation={:?})",
body_id,
obligation
);

self.region_obligations
.borrow_mut()
.push((body_id, obligation));
Expand Down Expand Up @@ -139,6 +144,8 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
"cannot process registered region obligations in a snapshot"
);

debug!("process_registered_region_obligations()");

// pull out the region obligations with the given `body_id` (leaving the rest)
let mut my_region_obligations = Vec::with_capacity(self.region_obligations.borrow().len());
{
Expand All @@ -157,6 +164,13 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
cause,
} in my_region_obligations
{
debug!(
"process_registered_region_obligations: sup_type={:?} sub_region={:?} cause={:?}",
sup_type,
sub_region,
cause
);

let origin = SubregionOrigin::from_obligation_cause(
&cause,
|| infer::RelateParamBound(cause.span, sup_type),
Expand Down
12 changes: 12 additions & 0 deletions src/librustc_mir/transform/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,12 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
) {
let tcx = self.tcx();

debug!(
"prove_aggregate_predicates(aggregate_kind={:?}, location={:?})",
aggregate_kind,
location
);

let instantiated_predicates = match aggregate_kind {
AggregateKind::Adt(def, _, substs, _) => {
tcx.predicates_of(def.did).instantiate(tcx, substs)
Expand All @@ -1299,6 +1305,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
};

let predicates = self.normalize(&instantiated_predicates.predicates, location);
debug!("prove_aggregate_predicates: predicates={:?}", predicates);
self.prove_predicates(&predicates, location);
}

Expand All @@ -1312,6 +1319,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
}

fn prove_predicates(&mut self, predicates: &[ty::Predicate<'tcx>], location: Location) {
debug!(
"prove_predicates(predicates={:?}, location={:?})",
predicates,
location
);
self.fully_perform_op(location.at_self(), |this| {
let cause = this.misc(this.last_span);
let obligations = predicates
Expand Down

0 comments on commit 4449240

Please sign in to comment.