@@ -4084,7 +4084,6 @@ impl<'o, 'tcx> TraitObligationStack<'o, 'tcx> {
40844084/// provisional results added from the subtree that encountered the
40854085/// error. When we pop the node at `reached_depth` from the stack, we
40864086/// can commit all the things that remain in the provisional cache.
4087- #[ derive( Default ) ]
40884087struct ProvisionalEvaluationCache < ' tcx > {
40894088 /// next "depth first number" to issue -- just a counter
40904089 dfn : Cell < usize > ,
@@ -4132,6 +4131,16 @@ struct ProvisionalEvaluation {
41324131 result : EvaluationResult ,
41334132}
41344133
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+
41354144impl < ' tcx > ProvisionalEvaluationCache < ' tcx > {
41364145 /// Get the next DFN in sequence (basically a counter).
41374146 fn next_dfn ( & self ) -> usize {
@@ -4146,9 +4155,10 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
41464155 /// `self.current_reached_depth()` and above.
41474156 fn get_provisional ( & self , fresh_trait_ref : ty:: PolyTraitRef < ' tcx > ) -> Option < EvaluationResult > {
41484157 debug ! (
4149- "get_provisional(fresh_trait_ref={:?}) = {:#?}" ,
4158+ "get_provisional(fresh_trait_ref={:?}) = {:#?} with reached-depth {} " ,
41504159 fresh_trait_ref,
41514160 self . map. borrow( ) . get( & fresh_trait_ref) ,
4161+ self . reached_depth. get( ) ,
41524162 ) ;
41534163 Some ( self . map . borrow ( ) . get ( & fresh_trait_ref) ?. result )
41544164 }
@@ -4240,7 +4250,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
42404250 op ( fresh_trait_ref, eval. result ) ;
42414251 }
42424252
4243- self . reached_depth . set ( depth ) ;
4253+ self . reached_depth . set ( std :: usize :: MAX ) ;
42444254 }
42454255}
42464256
0 commit comments