Skip to content

Commit eaf13b2

Browse files
committed
better debug dumping with inference variables
1 parent 75543c0 commit eaf13b2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/librustc/infer/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
643643
-> T::Lifted
644644
where T: TypeFoldable<'tcx> + ty::Lift<'gcx>
645645
{
646+
debug!("drain_fulfillment_cx_or_panic()");
647+
646648
let when = "resolving bounds after type-checking";
647649
let v = match self.drain_fulfillment_cx(fulfill_cx, result) {
648650
Ok(v) => v,
@@ -817,6 +819,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
817819
}
818820

819821
fn start_snapshot(&self) -> CombinedSnapshot {
822+
debug!("start_snapshot()");
823+
820824
let obligations_in_snapshot = self.obligations_in_snapshot.get();
821825
self.obligations_in_snapshot.set(false);
822826

@@ -854,7 +858,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
854858
}
855859

856860
fn commit_from(&self, snapshot: CombinedSnapshot) {
857-
debug!("commit_from!");
861+
debug!("commit_from()");
858862
let CombinedSnapshot { type_snapshot,
859863
int_snapshot,
860864
float_snapshot,

src/librustc/infer/type_variable.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ impl<'tcx> TypeVariableTable<'tcx> {
178178
value: Bounded { relations: vec![], default: default },
179179
diverging: diverging
180180
});
181-
ty::TyVid { index: index as u32 }
181+
let v = ty::TyVid { index: index as u32 };
182+
debug!("new_var() -> {:?}", v);
183+
v
182184
}
183185

184186
pub fn root_var(&mut self, vid: ty::TyVid) -> ty::TyVid {
@@ -219,6 +221,17 @@ impl<'tcx> TypeVariableTable<'tcx> {
219221
}
220222

221223
pub fn rollback_to(&mut self, s: Snapshot) {
224+
debug!("rollback_to{:?}", {
225+
for action in self.values.actions_since_snapshot(&s.snapshot) {
226+
match *action {
227+
sv::UndoLog::NewElem(index) => {
228+
debug!("inference variable _#{}t popped", index)
229+
}
230+
_ => { }
231+
}
232+
}
233+
});
234+
222235
self.values.rollback_to(s.snapshot);
223236
self.eq_relations.rollback_to(s.eq_snapshot);
224237
}

0 commit comments

Comments
 (0)