@@ -275,9 +275,6 @@ where
275
275
// corecursive functions as explained in #136824, relating types never
276
276
// introduces a constructor which could cause the recursion to be guarded.
277
277
GoalSource :: TypeRelating => PathKind :: Inductive ,
278
- // Instantiating a higher ranked goal can never cause the recursion to be
279
- // guarded and is therefore unproductive.
280
- GoalSource :: InstantiateHigherRanked => PathKind :: Inductive ,
281
278
// These goal sources are likely unproductive and can be changed to
282
279
// `PathKind::Inductive`. Keeping them as unknown until we're confident
283
280
// about this and have an example where it is necessary.
@@ -500,63 +497,53 @@ where
500
497
fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
501
498
let Goal { param_env, predicate } = goal;
502
499
let kind = predicate. kind ( ) ;
503
- if let Some ( kind) = kind. no_bound_vars ( ) {
504
- match kind {
505
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
506
- self . compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
507
- }
508
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
509
- self . compute_host_effect_goal ( Goal { param_env, predicate } )
510
- }
511
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
512
- self . compute_projection_goal ( Goal { param_env, predicate } )
513
- }
514
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
515
- self . compute_type_outlives_goal ( Goal { param_env, predicate } )
516
- }
517
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
518
- self . compute_region_outlives_goal ( Goal { param_env, predicate } )
519
- }
520
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
521
- self . compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
522
- }
523
- ty:: PredicateKind :: Subtype ( predicate) => {
524
- self . compute_subtype_goal ( Goal { param_env, predicate } )
525
- }
526
- ty:: PredicateKind :: Coerce ( predicate) => {
527
- self . compute_coerce_goal ( Goal { param_env, predicate } )
528
- }
529
- ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
530
- self . compute_dyn_compatible_goal ( trait_def_id)
531
- }
532
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
533
- self . compute_well_formed_goal ( Goal { param_env, predicate : term } )
534
- }
535
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
536
- self . compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
537
- }
538
- ty:: PredicateKind :: ConstEquate ( _, _) => {
539
- panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
540
- }
541
- ty:: PredicateKind :: NormalizesTo ( predicate) => {
542
- self . compute_normalizes_to_goal ( Goal { param_env, predicate } )
543
- }
544
- ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => self
545
- . compute_alias_relate_goal ( Goal {
546
- param_env,
547
- predicate : ( lhs, rhs, direction) ,
548
- } ) ,
549
- ty:: PredicateKind :: Ambiguous => {
550
- self . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
551
- }
500
+ self . enter_forall ( kind, |ecx, kind| match kind {
501
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
502
+ ecx. compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
552
503
}
553
- } else {
554
- self . enter_forall ( kind, |ecx, kind| {
555
- let goal = goal. with ( ecx. cx ( ) , ty:: Binder :: dummy ( kind) ) ;
556
- ecx. add_goal ( GoalSource :: InstantiateHigherRanked , goal) ;
557
- ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
558
- } )
559
- }
504
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
505
+ ecx. compute_host_effect_goal ( Goal { param_env, predicate } )
506
+ }
507
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
508
+ ecx. compute_projection_goal ( Goal { param_env, predicate } )
509
+ }
510
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
511
+ ecx. compute_type_outlives_goal ( Goal { param_env, predicate } )
512
+ }
513
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
514
+ ecx. compute_region_outlives_goal ( Goal { param_env, predicate } )
515
+ }
516
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
517
+ ecx. compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
518
+ }
519
+ ty:: PredicateKind :: Subtype ( predicate) => {
520
+ ecx. compute_subtype_goal ( Goal { param_env, predicate } )
521
+ }
522
+ ty:: PredicateKind :: Coerce ( predicate) => {
523
+ ecx. compute_coerce_goal ( Goal { param_env, predicate } )
524
+ }
525
+ ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
526
+ ecx. compute_dyn_compatible_goal ( trait_def_id)
527
+ }
528
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( arg) ) => {
529
+ ecx. compute_well_formed_goal ( Goal { param_env, predicate : arg } )
530
+ }
531
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
532
+ ecx. compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
533
+ }
534
+ ty:: PredicateKind :: ConstEquate ( _, _) => {
535
+ panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
536
+ }
537
+ ty:: PredicateKind :: NormalizesTo ( predicate) => {
538
+ ecx. compute_normalizes_to_goal ( Goal { param_env, predicate } )
539
+ }
540
+ ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => {
541
+ ecx. compute_alias_relate_goal ( Goal { param_env, predicate : ( lhs, rhs, direction) } )
542
+ }
543
+ ty:: PredicateKind :: Ambiguous => {
544
+ ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
545
+ }
546
+ } )
560
547
}
561
548
562
549
// Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
0 commit comments