@@ -4126,7 +4126,7 @@ struct ProvisionalEvaluationCache<'tcx> {
41264126
41274127/// A cache value for the provisional cache: contains the depth-first
41284128/// number (DFN) and result.
4129- #[ derive( Copy , Clone ) ]
4129+ #[ derive( Copy , Clone , Debug ) ]
41304130struct ProvisionalEvaluation {
41314131 from_dfn : usize ,
41324132 result : EvaluationResult ,
@@ -4145,6 +4145,11 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
41454145 /// it an access to the stack slots at depth
41464146 /// `self.current_reached_depth()` and above.
41474147 fn get_provisional ( & self , fresh_trait_ref : ty:: PolyTraitRef < ' tcx > ) -> Option < EvaluationResult > {
4148+ debug ! (
4149+ "get_provisional(fresh_trait_ref={:?}) = {:#?}" ,
4150+ fresh_trait_ref,
4151+ self . map. borrow( ) . get( & fresh_trait_ref) ,
4152+ ) ;
41484153 Some ( self . map . borrow ( ) . get ( & fresh_trait_ref) ?. result )
41494154 }
41504155
@@ -4166,9 +4171,18 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
41664171 fresh_trait_ref : ty:: PolyTraitRef < ' tcx > ,
41674172 result : EvaluationResult ,
41684173 ) {
4174+ debug ! (
4175+ "insert_provisional(from_dfn={}, reached_depth={}, fresh_trait_ref={:?}, result={:?})" ,
4176+ from_dfn,
4177+ reached_depth,
4178+ fresh_trait_ref,
4179+ result,
4180+ ) ;
41694181 let r_d = self . reached_depth . get ( ) ;
41704182 self . reached_depth . set ( r_d. min ( reached_depth) ) ;
41714183
4184+ debug ! ( "insert_provisional: reached_depth={:?}" , self . reached_depth. get( ) ) ;
4185+
41724186 self . map . borrow_mut ( ) . insert ( fresh_trait_ref, ProvisionalEvaluation { from_dfn, result } ) ;
41734187 }
41744188
@@ -4181,7 +4195,18 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
41814195 /// these provisional entries must either depend on it or some
41824196 /// ancestor of it.
41834197 fn on_failure ( & self , dfn : usize ) {
4184- self . map . borrow_mut ( ) . retain ( |_key, eval| eval. from_dfn >= dfn)
4198+ debug ! (
4199+ "on_failure(dfn={:?})" ,
4200+ dfn,
4201+ ) ;
4202+ self . map . borrow_mut ( ) . retain ( |key, eval| {
4203+ if !eval. from_dfn >= dfn {
4204+ debug ! ( "on_failure: removing {:?}" , key) ;
4205+ false
4206+ } else {
4207+ true
4208+ }
4209+ } ) ;
41854210 }
41864211
41874212 /// Invoked when the node at depth `depth` completed without
@@ -4194,11 +4219,24 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
41944219 depth : usize ,
41954220 mut op : impl FnMut ( ty:: PolyTraitRef < ' tcx > , EvaluationResult ) ,
41964221 ) {
4222+ debug ! (
4223+ "on_completion(depth={}, reached_depth={})" ,
4224+ depth,
4225+ self . reached_depth. get( ) ,
4226+ ) ;
4227+
41974228 if self . reached_depth . get ( ) < depth {
4229+ debug ! ( "on_completion: did not yet reach depth to complete" ) ;
41984230 return ;
41994231 }
42004232
42014233 for ( fresh_trait_ref, eval) in self . map . borrow_mut ( ) . drain ( ) {
4234+ debug ! (
4235+ "on_completion: fresh_trait_ref={:?} eval={:?}" ,
4236+ fresh_trait_ref,
4237+ eval,
4238+ ) ;
4239+
42024240 op ( fresh_trait_ref, eval. result ) ;
42034241 }
42044242
0 commit comments