@@ -286,9 +286,6 @@ where
286286 // corecursive functions as explained in #136824, relating types never
287287 // introduces a constructor which could cause the recursion to be guarded.
288288 GoalSource :: TypeRelating => PathKind :: Inductive ,
289- // Instantiating a higher ranked goal can never cause the recursion to be
290- // guarded and is therefore unproductive.
291- GoalSource :: InstantiateHigherRanked => PathKind :: Inductive ,
292289 // These goal sources are likely unproductive and can be changed to
293290 // `PathKind::Inductive`. Keeping them as unknown until we're confident
294291 // about this and have an example where it is necessary.
@@ -576,63 +573,53 @@ where
576573 fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
577574 let Goal { param_env, predicate } = goal;
578575 let kind = predicate. kind ( ) ;
579- if let Some ( kind) = kind. no_bound_vars ( ) {
580- match kind {
581- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
582- self . compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
583- }
584- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
585- self . compute_host_effect_goal ( Goal { param_env, predicate } )
586- }
587- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
588- self . compute_projection_goal ( Goal { param_env, predicate } )
589- }
590- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
591- self . compute_type_outlives_goal ( Goal { param_env, predicate } )
592- }
593- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
594- self . compute_region_outlives_goal ( Goal { param_env, predicate } )
595- }
596- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
597- self . compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
598- }
599- ty:: PredicateKind :: Subtype ( predicate) => {
600- self . compute_subtype_goal ( Goal { param_env, predicate } )
601- }
602- ty:: PredicateKind :: Coerce ( predicate) => {
603- self . compute_coerce_goal ( Goal { param_env, predicate } )
604- }
605- ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
606- self . compute_dyn_compatible_goal ( trait_def_id)
607- }
608- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
609- self . compute_well_formed_goal ( Goal { param_env, predicate : term } )
610- }
611- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
612- self . compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
613- }
614- ty:: PredicateKind :: ConstEquate ( _, _) => {
615- panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
616- }
617- ty:: PredicateKind :: NormalizesTo ( predicate) => {
618- self . compute_normalizes_to_goal ( Goal { param_env, predicate } )
619- }
620- ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => self
621- . compute_alias_relate_goal ( Goal {
622- param_env,
623- predicate : ( lhs, rhs, direction) ,
624- } ) ,
625- ty:: PredicateKind :: Ambiguous => {
626- self . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
627- }
576+ self . enter_forall ( kind, |ecx, kind| match kind {
577+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
578+ ecx. compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
628579 }
629- } else {
630- self . enter_forall ( kind, |ecx, kind| {
631- let goal = goal. with ( ecx. cx ( ) , ty:: Binder :: dummy ( kind) ) ;
632- ecx. add_goal ( GoalSource :: InstantiateHigherRanked , goal) ;
633- ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
634- } )
635- }
580+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
581+ ecx. compute_host_effect_goal ( Goal { param_env, predicate } )
582+ }
583+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
584+ ecx. compute_projection_goal ( Goal { param_env, predicate } )
585+ }
586+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
587+ ecx. compute_type_outlives_goal ( Goal { param_env, predicate } )
588+ }
589+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
590+ ecx. compute_region_outlives_goal ( Goal { param_env, predicate } )
591+ }
592+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
593+ ecx. compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
594+ }
595+ ty:: PredicateKind :: Subtype ( predicate) => {
596+ ecx. compute_subtype_goal ( Goal { param_env, predicate } )
597+ }
598+ ty:: PredicateKind :: Coerce ( predicate) => {
599+ ecx. compute_coerce_goal ( Goal { param_env, predicate } )
600+ }
601+ ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
602+ ecx. compute_dyn_compatible_goal ( trait_def_id)
603+ }
604+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( arg) ) => {
605+ ecx. compute_well_formed_goal ( Goal { param_env, predicate : arg } )
606+ }
607+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
608+ ecx. compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
609+ }
610+ ty:: PredicateKind :: ConstEquate ( _, _) => {
611+ panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
612+ }
613+ ty:: PredicateKind :: NormalizesTo ( predicate) => {
614+ ecx. compute_normalizes_to_goal ( Goal { param_env, predicate } )
615+ }
616+ ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => {
617+ ecx. compute_alias_relate_goal ( Goal { param_env, predicate : ( lhs, rhs, direction) } )
618+ }
619+ ty:: PredicateKind :: Ambiguous => {
620+ ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
621+ }
622+ } )
636623 }
637624
638625 // Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
0 commit comments