@@ -5,7 +5,7 @@ use rustc_middle::traits::solve::{
55} ;
66use rustc_middle:: ty;
77
8- pub mod dump ;
8+ use super :: eval_ctxt :: DisableGlobalCache ;
99
1010#[ derive( Eq , PartialEq , Debug , Hash , HashStable ) ]
1111pub struct WipGoalEvaluation < ' tcx > {
@@ -145,11 +145,15 @@ impl<'tcx> From<WipGoalCandidate<'tcx>> for DebugSolver<'tcx> {
145145
146146pub struct ProofTreeBuilder < ' tcx > {
147147 state : Option < Box < DebugSolver < ' tcx > > > ,
148+ disable_global_cache : DisableGlobalCache ,
148149}
149150
150151impl < ' tcx > ProofTreeBuilder < ' tcx > {
151- fn new ( state : impl Into < DebugSolver < ' tcx > > ) -> ProofTreeBuilder < ' tcx > {
152- ProofTreeBuilder { state : Some ( Box :: new ( state. into ( ) ) ) }
152+ fn new (
153+ state : impl Into < DebugSolver < ' tcx > > ,
154+ disable_global_cache : DisableGlobalCache ,
155+ ) -> ProofTreeBuilder < ' tcx > {
156+ ProofTreeBuilder { state : Some ( Box :: new ( state. into ( ) ) ) , disable_global_cache }
153157 }
154158
155159 fn as_mut ( & mut self ) -> Option < & mut DebugSolver < ' tcx > > {
@@ -165,12 +169,16 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
165169 }
166170 }
167171
168- pub fn new_root ( ) -> ProofTreeBuilder < ' tcx > {
169- ProofTreeBuilder :: new ( DebugSolver :: Root )
172+ pub fn disable_global_cache ( & self ) -> DisableGlobalCache {
173+ self . disable_global_cache
174+ }
175+
176+ pub fn new_root ( disable_global_cache : DisableGlobalCache ) -> ProofTreeBuilder < ' tcx > {
177+ ProofTreeBuilder :: new ( DebugSolver :: Root , disable_global_cache)
170178 }
171179
172180 pub fn new_noop ( ) -> ProofTreeBuilder < ' tcx > {
173- ProofTreeBuilder { state : None }
181+ ProofTreeBuilder { state : None , disable_global_cache : DisableGlobalCache :: No }
174182 }
175183
176184 pub fn is_noop ( & self ) -> bool {
@@ -183,18 +191,24 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
183191 is_normalizes_to_hack : IsNormalizesToHack ,
184192 ) -> ProofTreeBuilder < ' tcx > {
185193 if self . state . is_none ( ) {
186- return ProofTreeBuilder { state : None } ;
194+ return ProofTreeBuilder {
195+ state : None ,
196+ disable_global_cache : self . disable_global_cache ,
197+ } ;
187198 }
188199
189- ProofTreeBuilder :: new ( WipGoalEvaluation {
190- uncanonicalized_goal : goal,
191- canonicalized_goal : None ,
192- evaluation_steps : vec ! [ ] ,
193- is_normalizes_to_hack,
194- cache_hit : None ,
195- returned_goals : vec ! [ ] ,
196- result : None ,
197- } )
200+ ProofTreeBuilder :: new (
201+ WipGoalEvaluation {
202+ uncanonicalized_goal : goal,
203+ canonicalized_goal : None ,
204+ evaluation_steps : vec ! [ ] ,
205+ is_normalizes_to_hack,
206+ cache_hit : None ,
207+ returned_goals : vec ! [ ] ,
208+ result : None ,
209+ } ,
210+ self . disable_global_cache ,
211+ )
198212 }
199213
200214 pub fn canonicalized_goal ( & mut self , canonical_goal : CanonicalInput < ' tcx > ) {
@@ -250,15 +264,21 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
250264 instantiated_goal : QueryInput < ' tcx , ty:: Predicate < ' tcx > > ,
251265 ) -> ProofTreeBuilder < ' tcx > {
252266 if self . state . is_none ( ) {
253- return ProofTreeBuilder { state : None } ;
267+ return ProofTreeBuilder {
268+ state : None ,
269+ disable_global_cache : self . disable_global_cache ,
270+ } ;
254271 }
255272
256- ProofTreeBuilder :: new ( WipGoalEvaluationStep {
257- instantiated_goal,
258- nested_goal_evaluations : vec ! [ ] ,
259- candidates : vec ! [ ] ,
260- result : None ,
261- } )
273+ ProofTreeBuilder :: new (
274+ WipGoalEvaluationStep {
275+ instantiated_goal,
276+ nested_goal_evaluations : vec ! [ ] ,
277+ candidates : vec ! [ ] ,
278+ result : None ,
279+ } ,
280+ self . disable_global_cache ,
281+ )
262282 }
263283 pub fn goal_evaluation_step ( & mut self , goal_eval_step : ProofTreeBuilder < ' tcx > ) {
264284 if let Some ( this) = self . as_mut ( ) {
@@ -273,14 +293,17 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
273293
274294 pub fn new_goal_candidate ( & mut self ) -> ProofTreeBuilder < ' tcx > {
275295 if self . state . is_none ( ) {
276- return ProofTreeBuilder { state : None } ;
296+ return ProofTreeBuilder {
297+ state : None ,
298+
299+ disable_global_cache : self . disable_global_cache ,
300+ } ;
277301 }
278302
279- ProofTreeBuilder :: new ( WipGoalCandidate {
280- nested_goal_evaluations : vec ! [ ] ,
281- candidates : vec ! [ ] ,
282- kind : None ,
283- } )
303+ ProofTreeBuilder :: new (
304+ WipGoalCandidate { nested_goal_evaluations : vec ! [ ] , candidates : vec ! [ ] , kind : None } ,
305+ self . disable_global_cache ,
306+ )
284307 }
285308
286309 pub fn candidate_kind ( & mut self , candidate_kind : CandidateKind < ' tcx > ) {
@@ -309,10 +332,17 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
309332
310333 pub fn new_evaluate_added_goals ( & mut self ) -> ProofTreeBuilder < ' tcx > {
311334 if self . state . is_none ( ) {
312- return ProofTreeBuilder { state : None } ;
335+ return ProofTreeBuilder {
336+ state : None ,
337+
338+ disable_global_cache : self . disable_global_cache ,
339+ } ;
313340 }
314341
315- ProofTreeBuilder :: new ( WipAddedGoalsEvaluation { evaluations : vec ! [ ] , result : None } )
342+ ProofTreeBuilder :: new (
343+ WipAddedGoalsEvaluation { evaluations : vec ! [ ] , result : None } ,
344+ self . disable_global_cache ,
345+ )
316346 }
317347
318348 pub fn evaluate_added_goals_loop_start ( & mut self ) {
0 commit comments