@@ -5,7 +5,7 @@ use rustc_middle::traits::solve::{
5
5
} ;
6
6
use rustc_middle:: ty;
7
7
8
- pub mod dump ;
8
+ use super :: eval_ctxt :: DisableGlobalCache ;
9
9
10
10
#[ derive( Eq , PartialEq , Debug , Hash , HashStable ) ]
11
11
pub struct WipGoalEvaluation < ' tcx > {
@@ -145,11 +145,15 @@ impl<'tcx> From<WipGoalCandidate<'tcx>> for DebugSolver<'tcx> {
145
145
146
146
pub struct ProofTreeBuilder < ' tcx > {
147
147
state : Option < Box < DebugSolver < ' tcx > > > ,
148
+ disable_global_cache : DisableGlobalCache ,
148
149
}
149
150
150
151
impl < ' 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 }
153
157
}
154
158
155
159
fn as_mut ( & mut self ) -> Option < & mut DebugSolver < ' tcx > > {
@@ -165,12 +169,16 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
165
169
}
166
170
}
167
171
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)
170
178
}
171
179
172
180
pub fn new_noop ( ) -> ProofTreeBuilder < ' tcx > {
173
- ProofTreeBuilder { state : None }
181
+ ProofTreeBuilder { state : None , disable_global_cache : DisableGlobalCache :: No }
174
182
}
175
183
176
184
pub fn is_noop ( & self ) -> bool {
@@ -183,18 +191,24 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
183
191
is_normalizes_to_hack : IsNormalizesToHack ,
184
192
) -> ProofTreeBuilder < ' tcx > {
185
193
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
+ } ;
187
198
}
188
199
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
+ )
198
212
}
199
213
200
214
pub fn canonicalized_goal ( & mut self , canonical_goal : CanonicalInput < ' tcx > ) {
@@ -250,15 +264,21 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
250
264
instantiated_goal : QueryInput < ' tcx , ty:: Predicate < ' tcx > > ,
251
265
) -> ProofTreeBuilder < ' tcx > {
252
266
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
+ } ;
254
271
}
255
272
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
+ )
262
282
}
263
283
pub fn goal_evaluation_step ( & mut self , goal_eval_step : ProofTreeBuilder < ' tcx > ) {
264
284
if let Some ( this) = self . as_mut ( ) {
@@ -273,14 +293,17 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
273
293
274
294
pub fn new_goal_candidate ( & mut self ) -> ProofTreeBuilder < ' tcx > {
275
295
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
+ } ;
277
301
}
278
302
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
+ )
284
307
}
285
308
286
309
pub fn candidate_kind ( & mut self , candidate_kind : CandidateKind < ' tcx > ) {
@@ -309,10 +332,17 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
309
332
310
333
pub fn new_evaluate_added_goals ( & mut self ) -> ProofTreeBuilder < ' tcx > {
311
334
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
+ } ;
313
340
}
314
341
315
- ProofTreeBuilder :: new ( WipAddedGoalsEvaluation { evaluations : vec ! [ ] , result : None } )
342
+ ProofTreeBuilder :: new (
343
+ WipAddedGoalsEvaluation { evaluations : vec ! [ ] , result : None } ,
344
+ self . disable_global_cache ,
345
+ )
316
346
}
317
347
318
348
pub fn evaluate_added_goals_loop_start ( & mut self ) {
0 commit comments