@@ -4084,7 +4084,6 @@ impl<'o, 'tcx> TraitObligationStack<'o, 'tcx> {
4084
4084
/// provisional results added from the subtree that encountered the
4085
4085
/// error. When we pop the node at `reached_depth` from the stack, we
4086
4086
/// can commit all the things that remain in the provisional cache.
4087
- #[ derive( Default ) ]
4088
4087
struct ProvisionalEvaluationCache < ' tcx > {
4089
4088
/// next "depth first number" to issue -- just a counter
4090
4089
dfn : Cell < usize > ,
@@ -4132,6 +4131,16 @@ struct ProvisionalEvaluation {
4132
4131
result : EvaluationResult ,
4133
4132
}
4134
4133
4134
+ impl < ' tcx > Default for ProvisionalEvaluationCache < ' tcx > {
4135
+ fn default ( ) -> Self {
4136
+ Self {
4137
+ dfn : Cell :: new ( 0 ) ,
4138
+ reached_depth : Cell :: new ( std:: usize:: MAX ) ,
4139
+ map : Default :: default ( ) ,
4140
+ }
4141
+ }
4142
+ }
4143
+
4135
4144
impl < ' tcx > ProvisionalEvaluationCache < ' tcx > {
4136
4145
/// Get the next DFN in sequence (basically a counter).
4137
4146
fn next_dfn ( & self ) -> usize {
@@ -4146,9 +4155,10 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
4146
4155
/// `self.current_reached_depth()` and above.
4147
4156
fn get_provisional ( & self , fresh_trait_ref : ty:: PolyTraitRef < ' tcx > ) -> Option < EvaluationResult > {
4148
4157
debug ! (
4149
- "get_provisional(fresh_trait_ref={:?}) = {:#?}" ,
4158
+ "get_provisional(fresh_trait_ref={:?}) = {:#?} with reached-depth {} " ,
4150
4159
fresh_trait_ref,
4151
4160
self . map. borrow( ) . get( & fresh_trait_ref) ,
4161
+ self . reached_depth. get( ) ,
4152
4162
) ;
4153
4163
Some ( self . map . borrow ( ) . get ( & fresh_trait_ref) ?. result )
4154
4164
}
@@ -4240,7 +4250,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
4240
4250
op ( fresh_trait_ref, eval. result ) ;
4241
4251
}
4242
4252
4243
- self . reached_depth . set ( depth ) ;
4253
+ self . reached_depth . set ( std :: usize :: MAX ) ;
4244
4254
}
4245
4255
}
4246
4256
0 commit comments