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