From d3afbd6c4d03cfde1291da53f3830d1dbd44f35e Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 21 May 2016 05:42:27 -0400 Subject: [PATCH] more debug dumping in traits --- src/librustc/traits/fulfill.rs | 6 ++++-- src/librustc/traits/project.rs | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 0d7d7afd120..601fd899ff8 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -171,10 +171,12 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { // debug output much nicer to read and so on. let obligation = infcx.resolve_type_vars_if_possible(&obligation); + debug!("register_predicate_obligation(obligation={:?})", obligation); + infcx.obligations_in_snapshot.set(true); - if infcx.tcx.fulfilled_predicates.borrow().check_duplicate(&obligation.predicate) - { + if infcx.tcx.fulfilled_predicates.borrow().check_duplicate(&obligation.predicate) { + debug!("register_predicate_obligation: duplicate"); return } diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 1cfdf73ae8e..011662fe8c2 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -257,9 +257,13 @@ pub fn normalize_with_depth<'a, 'b, 'gcx, 'tcx, T>( where T : TypeFoldable<'tcx> { + debug!("normalize_with_depth(depth={}, value={:?})", depth, value); let mut normalizer = AssociatedTypeNormalizer::new(selcx, cause, depth); let result = normalizer.fold(value); - + debug!("normalize_with_depth: depth={} result={:?} with {} obligations", + depth, result, normalizer.obligations.len()); + debug!("normalize_with_depth: depth={} obligations={:?}", + depth, normalizer.obligations); Normalized { value: result, obligations: normalizer.obligations, @@ -331,13 +335,15 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, // binder). It would be better to normalize in a // binding-aware fashion. - let Normalized { value: ty, obligations } = + let Normalized { value: normalized_ty, obligations } = normalize_projection_type(self.selcx, data.clone(), self.cause.clone(), self.depth); + debug!("AssociatedTypeNormalizer: depth={} normalized {:?} to {:?} with {} add'l obligations", + self.depth, ty, normalized_ty, obligations.len()); self.obligations.extend(obligations); - ty + normalized_ty } _ => {