@@ -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.
@@ -507,63 +504,53 @@ where
507
504
fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
508
505
let Goal { param_env, predicate } = goal;
509
506
let kind = predicate. kind ( ) ;
510
- if let Some ( kind) = kind. no_bound_vars ( ) {
511
- match kind {
512
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
513
- self . compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
514
- }
515
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
516
- self . compute_host_effect_goal ( Goal { param_env, predicate } )
517
- }
518
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
519
- self . compute_projection_goal ( Goal { param_env, predicate } )
520
- }
521
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
522
- self . compute_type_outlives_goal ( Goal { param_env, predicate } )
523
- }
524
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
525
- self . compute_region_outlives_goal ( Goal { param_env, predicate } )
526
- }
527
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
528
- self . compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
529
- }
530
- ty:: PredicateKind :: Subtype ( predicate) => {
531
- self . compute_subtype_goal ( Goal { param_env, predicate } )
532
- }
533
- ty:: PredicateKind :: Coerce ( predicate) => {
534
- self . compute_coerce_goal ( Goal { param_env, predicate } )
535
- }
536
- ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
537
- self . compute_dyn_compatible_goal ( trait_def_id)
538
- }
539
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
540
- self . compute_well_formed_goal ( Goal { param_env, predicate : term } )
541
- }
542
- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
543
- self . compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
544
- }
545
- ty:: PredicateKind :: ConstEquate ( _, _) => {
546
- panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
547
- }
548
- ty:: PredicateKind :: NormalizesTo ( predicate) => {
549
- self . compute_normalizes_to_goal ( Goal { param_env, predicate } )
550
- }
551
- ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => self
552
- . compute_alias_relate_goal ( Goal {
553
- param_env,
554
- predicate : ( lhs, rhs, direction) ,
555
- } ) ,
556
- ty:: PredicateKind :: Ambiguous => {
557
- self . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
558
- }
507
+ self . enter_forall ( kind, |ecx, kind| match kind {
508
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
509
+ ecx. compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
559
510
}
560
- } else {
561
- self . enter_forall ( kind, |ecx, kind| {
562
- let goal = goal. with ( ecx. cx ( ) , ty:: Binder :: dummy ( kind) ) ;
563
- ecx. add_goal ( GoalSource :: InstantiateHigherRanked , goal) ;
564
- ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
565
- } )
566
- }
511
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
512
+ ecx. compute_host_effect_goal ( Goal { param_env, predicate } )
513
+ }
514
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
515
+ ecx. compute_projection_goal ( Goal { param_env, predicate } )
516
+ }
517
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
518
+ ecx. compute_type_outlives_goal ( Goal { param_env, predicate } )
519
+ }
520
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
521
+ ecx. compute_region_outlives_goal ( Goal { param_env, predicate } )
522
+ }
523
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
524
+ ecx. compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
525
+ }
526
+ ty:: PredicateKind :: Subtype ( predicate) => {
527
+ ecx. compute_subtype_goal ( Goal { param_env, predicate } )
528
+ }
529
+ ty:: PredicateKind :: Coerce ( predicate) => {
530
+ ecx. compute_coerce_goal ( Goal { param_env, predicate } )
531
+ }
532
+ ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
533
+ ecx. compute_dyn_compatible_goal ( trait_def_id)
534
+ }
535
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( arg) ) => {
536
+ ecx. compute_well_formed_goal ( Goal { param_env, predicate : arg } )
537
+ }
538
+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
539
+ ecx. compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
540
+ }
541
+ ty:: PredicateKind :: ConstEquate ( _, _) => {
542
+ panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
543
+ }
544
+ ty:: PredicateKind :: NormalizesTo ( predicate) => {
545
+ ecx. compute_normalizes_to_goal ( Goal { param_env, predicate } )
546
+ }
547
+ ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => {
548
+ ecx. compute_alias_relate_goal ( Goal { param_env, predicate : ( lhs, rhs, direction) } )
549
+ }
550
+ ty:: PredicateKind :: Ambiguous => {
551
+ ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
552
+ }
553
+ } )
567
554
}
568
555
569
556
// Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
0 commit comments