@@ -4126,7 +4126,7 @@ struct ProvisionalEvaluationCache<'tcx> {
4126
4126
4127
4127
/// A cache value for the provisional cache: contains the depth-first
4128
4128
/// number (DFN) and result.
4129
- #[ derive( Copy , Clone ) ]
4129
+ #[ derive( Copy , Clone , Debug ) ]
4130
4130
struct ProvisionalEvaluation {
4131
4131
from_dfn : usize ,
4132
4132
result : EvaluationResult ,
@@ -4145,6 +4145,11 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
4145
4145
/// it an access to the stack slots at depth
4146
4146
/// `self.current_reached_depth()` and above.
4147
4147
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
+ ) ;
4148
4153
Some ( self . map . borrow ( ) . get ( & fresh_trait_ref) ?. result )
4149
4154
}
4150
4155
@@ -4166,9 +4171,18 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
4166
4171
fresh_trait_ref : ty:: PolyTraitRef < ' tcx > ,
4167
4172
result : EvaluationResult ,
4168
4173
) {
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
+ ) ;
4169
4181
let r_d = self . reached_depth . get ( ) ;
4170
4182
self . reached_depth . set ( r_d. min ( reached_depth) ) ;
4171
4183
4184
+ debug ! ( "insert_provisional: reached_depth={:?}" , self . reached_depth. get( ) ) ;
4185
+
4172
4186
self . map . borrow_mut ( ) . insert ( fresh_trait_ref, ProvisionalEvaluation { from_dfn, result } ) ;
4173
4187
}
4174
4188
@@ -4181,7 +4195,18 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
4181
4195
/// these provisional entries must either depend on it or some
4182
4196
/// ancestor of it.
4183
4197
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
+ } ) ;
4185
4210
}
4186
4211
4187
4212
/// Invoked when the node at depth `depth` completed without
@@ -4194,11 +4219,24 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
4194
4219
depth : usize ,
4195
4220
mut op : impl FnMut ( ty:: PolyTraitRef < ' tcx > , EvaluationResult ) ,
4196
4221
) {
4222
+ debug ! (
4223
+ "on_completion(depth={}, reached_depth={})" ,
4224
+ depth,
4225
+ self . reached_depth. get( ) ,
4226
+ ) ;
4227
+
4197
4228
if self . reached_depth . get ( ) < depth {
4229
+ debug ! ( "on_completion: did not yet reach depth to complete" ) ;
4198
4230
return ;
4199
4231
}
4200
4232
4201
4233
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
+
4202
4240
op ( fresh_trait_ref, eval. result ) ;
4203
4241
}
4204
4242
0 commit comments