improve debug output related to bound calculation

This commit is contained in:
Niko Matsakis 2018-11-16 08:25:46 -05:00
parent 6b9b97bd9b
commit 0d744ec6ec
4 changed files with 33 additions and 5 deletions

View File

@ -700,7 +700,12 @@ fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
predicates: Vec<ty::Predicate<'tcx>>)
-> Result<Vec<ty::Predicate<'tcx>>, ErrorReported>
{
debug!("do_normalize_predicates({:?})", predicates);
debug!(
"do_normalize_predicates(predicates={:?}, region_context={:?}, cause={:?})",
predicates,
region_context,
cause,
);
let span = cause.span;
tcx.infer_ctxt().enter(|infcx| {
// FIXME. We should really... do something with these region

View File

@ -1608,10 +1608,21 @@ fn predicates_defined_on<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
) -> Lrc<ty::GenericPredicates<'tcx>> {
debug!("predicates_defined_on({:?})", def_id);
let mut result = tcx.explicit_predicates_of(def_id);
debug!(
"predicates_defined_on: explicit_predicates_of({:?}) = {:?}",
def_id,
result,
);
let inferred_outlives = tcx.inferred_outlives_of(def_id);
if !inferred_outlives.is_empty() {
let span = tcx.def_span(def_id);
debug!(
"predicates_defined_on: inferred_outlives_of({:?}) = {:?}",
def_id,
inferred_outlives,
);
Lrc::make_mut(&mut result)
.predicates
.extend(inferred_outlives.iter().map(|&p| (p, span)));

View File

@ -245,6 +245,7 @@ fn insert_required_predicates_to_be_wf<'tcx>(
}
}
#[derive(Debug)]
pub struct IgnoreSelfTy(bool);
/// We also have to check the explicit predicates
@ -270,10 +271,18 @@ pub fn check_explicit_predicates<'tcx>(
explicit_map: &mut ExplicitPredicatesMap<'tcx>,
ignore_self_ty: IgnoreSelfTy,
) {
debug!("def_id = {:?}", &def_id);
debug!("substs = {:?}", &substs);
debug!("explicit_map = {:?}", explicit_map);
debug!("required_predicates = {:?}", required_predicates);
debug!(
"check_explicit_predicates(def_id={:?}, \
substs={:?}, \
explicit_map={:?}, \
required_predicates={:?}, \
ignore_self_ty={:?})",
def_id,
substs,
explicit_map,
required_predicates,
ignore_self_ty,
);
let explicit_predicates = explicit_map.explicit_predicates_of(tcx, *def_id);
for outlives_predicate in explicit_predicates.iter() {

View File

@ -67,6 +67,9 @@ fn inferred_outlives_of<'a, 'tcx>(
}
err.emit();
}
debug!("inferred_outlives_of({:?}) = {:?}", item_def_id, predicates);
predicates
}