better debug dumping with inference variables

This commit is contained in:
Niko Matsakis 2016-05-21 05:41:40 -04:00
parent 75543c08c7
commit eaf13b2f01
2 changed files with 19 additions and 2 deletions

View File

@ -643,6 +643,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
-> T::Lifted
where T: TypeFoldable<'tcx> + ty::Lift<'gcx>
{
debug!("drain_fulfillment_cx_or_panic()");
let when = "resolving bounds after type-checking";
let v = match self.drain_fulfillment_cx(fulfill_cx, result) {
Ok(v) => v,
@ -817,6 +819,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
fn start_snapshot(&self) -> CombinedSnapshot {
debug!("start_snapshot()");
let obligations_in_snapshot = self.obligations_in_snapshot.get();
self.obligations_in_snapshot.set(false);
@ -854,7 +858,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
fn commit_from(&self, snapshot: CombinedSnapshot) {
debug!("commit_from!");
debug!("commit_from()");
let CombinedSnapshot { type_snapshot,
int_snapshot,
float_snapshot,

View File

@ -178,7 +178,9 @@ impl<'tcx> TypeVariableTable<'tcx> {
value: Bounded { relations: vec![], default: default },
diverging: diverging
});
ty::TyVid { index: index as u32 }
let v = ty::TyVid { index: index as u32 };
debug!("new_var() -> {:?}", v);
v
}
pub fn root_var(&mut self, vid: ty::TyVid) -> ty::TyVid {
@ -219,6 +221,17 @@ impl<'tcx> TypeVariableTable<'tcx> {
}
pub fn rollback_to(&mut self, s: Snapshot) {
debug!("rollback_to{:?}", {
for action in self.values.actions_since_snapshot(&s.snapshot) {
match *action {
sv::UndoLog::NewElem(index) => {
debug!("inference variable _#{}t popped", index)
}
_ => { }
}
}
});
self.values.rollback_to(s.snapshot);
self.eq_relations.rollback_to(s.eq_snapshot);
}