@@ -140,10 +140,7 @@ pub trait InferCtxtEvalExt<'tcx> {
140
140
& self ,
141
141
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
142
142
generate_proof_tree : GenerateProofTree ,
143
- ) -> (
144
- Result < ( bool , Certainty , Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ) , NoSolution > ,
145
- Option < inspect:: GoalEvaluation < ' tcx > > ,
146
- ) ;
143
+ ) -> ( Result < ( bool , Certainty ) , NoSolution > , Option < inspect:: GoalEvaluation < ' tcx > > ) ;
147
144
}
148
145
149
146
impl < ' tcx > InferCtxtEvalExt < ' tcx > for InferCtxt < ' tcx > {
@@ -152,10 +149,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
152
149
& self ,
153
150
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
154
151
generate_proof_tree : GenerateProofTree ,
155
- ) -> (
156
- Result < ( bool , Certainty , Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ) , NoSolution > ,
157
- Option < inspect:: GoalEvaluation < ' tcx > > ,
158
- ) {
152
+ ) -> ( Result < ( bool , Certainty ) , NoSolution > , Option < inspect:: GoalEvaluation < ' tcx > > ) {
159
153
EvalCtxt :: enter_root ( self , generate_proof_tree, |ecx| {
160
154
ecx. evaluate_goal ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal)
161
155
} )
@@ -337,7 +331,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
337
331
goal_evaluation_kind : GoalEvaluationKind ,
338
332
source : GoalSource ,
339
333
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
340
- ) -> Result < ( bool , Certainty , Vec < Goal < ' tcx , ty :: Predicate < ' tcx > > > ) , NoSolution > {
334
+ ) -> Result < ( bool , Certainty ) , NoSolution > {
341
335
let ( orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
342
336
let mut goal_evaluation =
343
337
self . inspect . new_goal_evaluation ( goal, & orig_values, goal_evaluation_kind) ;
@@ -355,26 +349,13 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
355
349
Ok ( response) => response,
356
350
} ;
357
351
358
- let ( certainty, has_changed, nested_goals) = match self
359
- . instantiate_response_discarding_overflow (
360
- goal. param_env ,
361
- source,
362
- orig_values,
363
- canonical_response,
364
- ) {
365
- Err ( e) => {
366
- self . inspect . goal_evaluation ( goal_evaluation) ;
367
- return Err ( e) ;
368
- }
369
- Ok ( response) => response,
370
- } ;
371
- goal_evaluation. returned_goals ( & nested_goals) ;
352
+ let ( certainty, has_changed) = self . instantiate_response_discarding_overflow (
353
+ goal. param_env ,
354
+ source,
355
+ orig_values,
356
+ canonical_response,
357
+ ) ;
372
358
self . inspect . goal_evaluation ( goal_evaluation) ;
373
-
374
- if !has_changed && !nested_goals. is_empty ( ) {
375
- bug ! ( "an unchanged goal shouldn't have any side-effects on instantiation" ) ;
376
- }
377
-
378
359
// FIXME: We previously had an assert here that checked that recomputing
379
360
// a goal after applying its constraints did not change its response.
380
361
//
@@ -385,7 +366,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
385
366
// Once we have decided on how to handle trait-system-refactor-initiative#75,
386
367
// we should re-add an assert here.
387
368
388
- Ok ( ( has_changed, certainty, nested_goals ) )
369
+ Ok ( ( has_changed, certainty) )
389
370
}
390
371
391
372
fn instantiate_response_discarding_overflow (
@@ -394,7 +375,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
394
375
source : GoalSource ,
395
376
original_values : Vec < ty:: GenericArg < ' tcx > > ,
396
377
response : CanonicalResponse < ' tcx > ,
397
- ) -> Result < ( Certainty , bool , Vec < Goal < ' tcx , ty :: Predicate < ' tcx > > > ) , NoSolution > {
378
+ ) -> ( Certainty , bool ) {
398
379
// The old solver did not evaluate nested goals when normalizing.
399
380
// It returned the selection constraints allowing a `Projection`
400
381
// obligation to not hold in coherence while avoiding the fatal error
@@ -415,14 +396,14 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
415
396
} ;
416
397
417
398
if response. value . certainty == Certainty :: OVERFLOW && !keep_overflow_constraints ( ) {
418
- Ok ( ( Certainty :: OVERFLOW , false , Vec :: new ( ) ) )
399
+ ( Certainty :: OVERFLOW , false )
419
400
} else {
420
401
let has_changed = !response. value . var_values . is_identity_modulo_regions ( )
421
402
|| !response. value . external_constraints . opaque_types . is_empty ( ) ;
422
403
423
- let ( certainty, nested_goals ) =
424
- self . instantiate_and_apply_query_response ( param_env, original_values, response) ? ;
425
- Ok ( ( certainty, has_changed, nested_goals ) )
404
+ let certainty =
405
+ self . instantiate_and_apply_query_response ( param_env, original_values, response) ;
406
+ ( certainty, has_changed)
426
407
}
427
408
}
428
409
@@ -546,12 +527,11 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
546
527
ty:: NormalizesTo { alias : goal. predicate . alias , term : unconstrained_rhs } ,
547
528
) ;
548
529
549
- let ( _, certainty, instantiate_goals ) = self . evaluate_goal (
530
+ let ( _, certainty) = self . evaluate_goal (
550
531
GoalEvaluationKind :: Nested { is_normalizes_to_hack : IsNormalizesToHack :: Yes } ,
551
532
GoalSource :: Misc ,
552
533
unconstrained_goal,
553
534
) ?;
554
- self . nested_goals . goals . extend ( with_misc_source ( instantiate_goals) ) ;
555
535
556
536
// Finally, equate the goal's RHS with the unconstrained var.
557
537
// We put the nested goals from this into goals instead of
@@ -582,12 +562,11 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
582
562
}
583
563
584
564
for ( source, goal) in goals. goals . drain ( ..) {
585
- let ( has_changed, certainty, instantiate_goals ) = self . evaluate_goal (
565
+ let ( has_changed, certainty) = self . evaluate_goal (
586
566
GoalEvaluationKind :: Nested { is_normalizes_to_hack : IsNormalizesToHack :: No } ,
587
567
source,
588
568
goal,
589
569
) ?;
590
- self . nested_goals . goals . extend ( with_misc_source ( instantiate_goals) ) ;
591
570
if has_changed {
592
571
unchanged_certainty = None ;
593
572
}
0 commit comments