@@ -265,9 +265,6 @@ where
265265 // corecursive functions as explained in #136824, relating types never
266266 // introduces a constructor which could cause the recursion to be guarded.
267267 GoalSource :: TypeRelating => PathKind :: Inductive ,
268- // Instantiating a higher ranked goal can never cause the recursion to be
269- // guarded and is therefore unproductive.
270- GoalSource :: InstantiateHigherRanked => PathKind :: Inductive ,
271268 // These goal sources are likely unproductive and can be changed to
272269 // `PathKind::Inductive`. Keeping them as unknown until we're confident
273270 // about this and have an example where it is necessary.
@@ -533,66 +530,56 @@ where
533530 pub ( super ) fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
534531 let Goal { param_env, predicate } = goal;
535532 let kind = predicate. kind ( ) ;
536- if let Some ( kind) = kind. no_bound_vars ( ) {
537- match kind {
538- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
539- self . compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
540- }
541- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
542- self . compute_host_effect_goal ( Goal { param_env, predicate } )
543- }
544- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
545- self . compute_projection_goal ( Goal { param_env, predicate } )
546- }
547- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
548- self . compute_type_outlives_goal ( Goal { param_env, predicate } )
549- }
550- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
551- self . compute_region_outlives_goal ( Goal { param_env, predicate } )
552- }
553- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
554- self . compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
555- }
556- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: UnstableFeature ( symbol) ) => {
557- self . compute_unstable_feature_goal ( param_env, symbol)
558- }
559- ty:: PredicateKind :: Subtype ( predicate) => {
560- self . compute_subtype_goal ( Goal { param_env, predicate } )
561- }
562- ty:: PredicateKind :: Coerce ( predicate) => {
563- self . compute_coerce_goal ( Goal { param_env, predicate } )
564- }
565- ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
566- self . compute_dyn_compatible_goal ( trait_def_id)
567- }
568- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
569- self . compute_well_formed_goal ( Goal { param_env, predicate : term } )
570- }
571- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
572- self . compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
573- }
574- ty:: PredicateKind :: ConstEquate ( _, _) => {
575- panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
576- }
577- ty:: PredicateKind :: NormalizesTo ( predicate) => {
578- self . compute_normalizes_to_goal ( Goal { param_env, predicate } )
579- }
580- ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => self
581- . compute_alias_relate_goal ( Goal {
582- param_env,
583- predicate : ( lhs, rhs, direction) ,
584- } ) ,
585- ty:: PredicateKind :: Ambiguous => {
586- self . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
587- }
533+ self . enter_forall ( kind, |ecx, kind| match kind {
534+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
535+ ecx. compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
588536 }
589- } else {
590- self . enter_forall ( kind, |ecx, kind| {
591- let goal = goal. with ( ecx. cx ( ) , ty:: Binder :: dummy ( kind) ) ;
592- ecx. add_goal ( GoalSource :: InstantiateHigherRanked , goal) ;
593- ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
594- } )
595- }
537+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
538+ ecx. compute_host_effect_goal ( Goal { param_env, predicate } )
539+ }
540+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
541+ ecx. compute_projection_goal ( Goal { param_env, predicate } )
542+ }
543+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
544+ ecx. compute_type_outlives_goal ( Goal { param_env, predicate } )
545+ }
546+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
547+ ecx. compute_region_outlives_goal ( Goal { param_env, predicate } )
548+ }
549+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
550+ ecx. compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
551+ }
552+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: UnstableFeature ( symbol) ) => {
553+ ecx. compute_unstable_feature_goal ( param_env, symbol)
554+ }
555+ ty:: PredicateKind :: Subtype ( predicate) => {
556+ ecx. compute_subtype_goal ( Goal { param_env, predicate } )
557+ }
558+ ty:: PredicateKind :: Coerce ( predicate) => {
559+ ecx. compute_coerce_goal ( Goal { param_env, predicate } )
560+ }
561+ ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
562+ ecx. compute_dyn_compatible_goal ( trait_def_id)
563+ }
564+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
565+ ecx. compute_well_formed_goal ( Goal { param_env, predicate : term } )
566+ }
567+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
568+ ecx. compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
569+ }
570+ ty:: PredicateKind :: ConstEquate ( _, _) => {
571+ panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
572+ }
573+ ty:: PredicateKind :: NormalizesTo ( predicate) => {
574+ ecx. compute_normalizes_to_goal ( Goal { param_env, predicate } )
575+ }
576+ ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => {
577+ ecx. compute_alias_relate_goal ( Goal { param_env, predicate : ( lhs, rhs, direction) } )
578+ }
579+ ty:: PredicateKind :: Ambiguous => {
580+ ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
581+ }
582+ } )
596583 }
597584
598585 // Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
0 commit comments