@@ -297,9 +297,6 @@ where
297297 // corecursive functions as explained in #136824, relating types never
298298 // introduces a constructor which could cause the recursion to be guarded.
299299 GoalSource :: TypeRelating => PathKind :: Inductive ,
300- // Instantiating a higher ranked goal can never cause the recursion to be
301- // guarded and is therefore unproductive.
302- GoalSource :: InstantiateHigherRanked => PathKind :: Inductive ,
303300 // These goal sources are likely unproductive and can be changed to
304301 // `PathKind::Inductive`. Keeping them as unknown until we're confident
305302 // about this and have an example where it is necessary.
@@ -567,66 +564,56 @@ where
567564 pub ( super ) fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
568565 let Goal { param_env, predicate } = goal;
569566 let kind = predicate. kind ( ) ;
570- if let Some ( kind) = kind. no_bound_vars ( ) {
571- match kind {
572- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
573- self . compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
574- }
575- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
576- self . compute_host_effect_goal ( Goal { param_env, predicate } )
577- }
578- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
579- self . compute_projection_goal ( Goal { param_env, predicate } )
580- }
581- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
582- self . compute_type_outlives_goal ( Goal { param_env, predicate } )
583- }
584- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
585- self . compute_region_outlives_goal ( Goal { param_env, predicate } )
586- }
587- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
588- self . compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
589- }
590- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: UnstableFeature ( symbol) ) => {
591- self . compute_unstable_feature_goal ( param_env, symbol)
592- }
593- ty:: PredicateKind :: Subtype ( predicate) => {
594- self . compute_subtype_goal ( Goal { param_env, predicate } )
595- }
596- ty:: PredicateKind :: Coerce ( predicate) => {
597- self . compute_coerce_goal ( Goal { param_env, predicate } )
598- }
599- ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
600- self . compute_dyn_compatible_goal ( trait_def_id)
601- }
602- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
603- self . compute_well_formed_goal ( Goal { param_env, predicate : term } )
604- }
605- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
606- self . compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
607- }
608- ty:: PredicateKind :: ConstEquate ( _, _) => {
609- panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
610- }
611- ty:: PredicateKind :: NormalizesTo ( predicate) => {
612- self . compute_normalizes_to_goal ( Goal { param_env, predicate } )
613- }
614- ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => self
615- . compute_alias_relate_goal ( Goal {
616- param_env,
617- predicate : ( lhs, rhs, direction) ,
618- } ) ,
619- ty:: PredicateKind :: Ambiguous => {
620- self . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
621- }
567+ self . enter_forall ( kind, |ecx, kind| match kind {
568+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
569+ ecx. compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
622570 }
623- } else {
624- self . enter_forall ( kind, |ecx, kind| {
625- let goal = goal. with ( ecx. cx ( ) , ty:: Binder :: dummy ( kind) ) ;
626- ecx. add_goal ( GoalSource :: InstantiateHigherRanked , goal) ;
627- ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
628- } )
629- }
571+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
572+ ecx. compute_host_effect_goal ( Goal { param_env, predicate } )
573+ }
574+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
575+ ecx. compute_projection_goal ( Goal { param_env, predicate } )
576+ }
577+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
578+ ecx. compute_type_outlives_goal ( Goal { param_env, predicate } )
579+ }
580+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
581+ ecx. compute_region_outlives_goal ( Goal { param_env, predicate } )
582+ }
583+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
584+ ecx. compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
585+ }
586+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: UnstableFeature ( symbol) ) => {
587+ ecx. compute_unstable_feature_goal ( param_env, symbol)
588+ }
589+ ty:: PredicateKind :: Subtype ( predicate) => {
590+ ecx. compute_subtype_goal ( Goal { param_env, predicate } )
591+ }
592+ ty:: PredicateKind :: Coerce ( predicate) => {
593+ ecx. compute_coerce_goal ( Goal { param_env, predicate } )
594+ }
595+ ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
596+ ecx. compute_dyn_compatible_goal ( trait_def_id)
597+ }
598+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
599+ ecx. compute_well_formed_goal ( Goal { param_env, predicate : term } )
600+ }
601+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
602+ ecx. compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
603+ }
604+ ty:: PredicateKind :: ConstEquate ( _, _) => {
605+ panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
606+ }
607+ ty:: PredicateKind :: NormalizesTo ( predicate) => {
608+ ecx. compute_normalizes_to_goal ( Goal { param_env, predicate } )
609+ }
610+ ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => {
611+ ecx. compute_alias_relate_goal ( Goal { param_env, predicate : ( lhs, rhs, direction) } )
612+ }
613+ ty:: PredicateKind :: Ambiguous => {
614+ ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
615+ }
616+ } )
630617 }
631618
632619 // Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
0 commit comments