From eaf13b2f01615a725e7414644d4002a3adca3b54 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 21 May 2016 05:41:40 -0400 Subject: [PATCH] better debug dumping with inference variables --- src/librustc/infer/mod.rs | 6 +++++- src/librustc/infer/type_variable.rs | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index a05660ffaaf..5a4d2c2c445 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -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, diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index c2a8d04ac00..badbeccee83 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -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); }