@@ -276,9 +276,6 @@ where
276276 // corecursive functions as explained in #136824, relating types never
277277 // introduces a constructor which could cause the recursion to be guarded.
278278 GoalSource :: TypeRelating => PathKind :: Inductive ,
279- // Instantiating a higher ranked goal can never cause the recursion to be
280- // guarded and is therefore unproductive.
281- GoalSource :: InstantiateHigherRanked => PathKind :: Inductive ,
282279 // These goal sources are likely unproductive and can be changed to
283280 // `PathKind::Inductive`. Keeping them as unknown until we're confident
284281 // about this and have an example where it is necessary.
@@ -508,63 +505,53 @@ where
508505 fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
509506 let Goal { param_env, predicate } = goal;
510507 let kind = predicate. kind ( ) ;
511- if let Some ( kind) = kind. no_bound_vars ( ) {
512- match kind {
513- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
514- self . compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
515- }
516- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
517- self . compute_host_effect_goal ( Goal { param_env, predicate } )
518- }
519- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
520- self . compute_projection_goal ( Goal { param_env, predicate } )
521- }
522- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
523- self . compute_type_outlives_goal ( Goal { param_env, predicate } )
524- }
525- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
526- self . compute_region_outlives_goal ( Goal { param_env, predicate } )
527- }
528- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
529- self . compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
530- }
531- ty:: PredicateKind :: Subtype ( predicate) => {
532- self . compute_subtype_goal ( Goal { param_env, predicate } )
533- }
534- ty:: PredicateKind :: Coerce ( predicate) => {
535- self . compute_coerce_goal ( Goal { param_env, predicate } )
536- }
537- ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
538- self . compute_dyn_compatible_goal ( trait_def_id)
539- }
540- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( term) ) => {
541- self . compute_well_formed_goal ( Goal { param_env, predicate : term } )
542- }
543- ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
544- self . compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
545- }
546- ty:: PredicateKind :: ConstEquate ( _, _) => {
547- panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
548- }
549- ty:: PredicateKind :: NormalizesTo ( predicate) => {
550- self . compute_normalizes_to_goal ( Goal { param_env, predicate } )
551- }
552- ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => self
553- . compute_alias_relate_goal ( Goal {
554- param_env,
555- predicate : ( lhs, rhs, direction) ,
556- } ) ,
557- ty:: PredicateKind :: Ambiguous => {
558- self . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
559- }
508+ self . enter_forall ( kind, |ecx, kind| match kind {
509+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( predicate) ) => {
510+ ecx. compute_trait_goal ( Goal { param_env, predicate } ) . map ( |( r, _via) | r)
560511 }
561- } else {
562- self . enter_forall ( kind, |ecx, kind| {
563- let goal = goal. with ( ecx. cx ( ) , ty:: Binder :: dummy ( kind) ) ;
564- ecx. add_goal ( GoalSource :: InstantiateHigherRanked , goal) ;
565- ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
566- } )
567- }
512+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( predicate) ) => {
513+ ecx. compute_host_effect_goal ( Goal { param_env, predicate } )
514+ }
515+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( predicate) ) => {
516+ ecx. compute_projection_goal ( Goal { param_env, predicate } )
517+ }
518+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( predicate) ) => {
519+ ecx. compute_type_outlives_goal ( Goal { param_env, predicate } )
520+ }
521+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( predicate) ) => {
522+ ecx. compute_region_outlives_goal ( Goal { param_env, predicate } )
523+ }
524+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
525+ ecx. compute_const_arg_has_type_goal ( Goal { param_env, predicate : ( ct, ty) } )
526+ }
527+ ty:: PredicateKind :: Subtype ( predicate) => {
528+ ecx. compute_subtype_goal ( Goal { param_env, predicate } )
529+ }
530+ ty:: PredicateKind :: Coerce ( predicate) => {
531+ ecx. compute_coerce_goal ( Goal { param_env, predicate } )
532+ }
533+ ty:: PredicateKind :: DynCompatible ( trait_def_id) => {
534+ ecx. compute_dyn_compatible_goal ( trait_def_id)
535+ }
536+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( arg) ) => {
537+ ecx. compute_well_formed_goal ( Goal { param_env, predicate : arg } )
538+ }
539+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ct) ) => {
540+ ecx. compute_const_evaluatable_goal ( Goal { param_env, predicate : ct } )
541+ }
542+ ty:: PredicateKind :: ConstEquate ( _, _) => {
543+ panic ! ( "ConstEquate should not be emitted when `-Znext-solver` is active" )
544+ }
545+ ty:: PredicateKind :: NormalizesTo ( predicate) => {
546+ ecx. compute_normalizes_to_goal ( Goal { param_env, predicate } )
547+ }
548+ ty:: PredicateKind :: AliasRelate ( lhs, rhs, direction) => {
549+ ecx. compute_alias_relate_goal ( Goal { param_env, predicate : ( lhs, rhs, direction) } )
550+ }
551+ ty:: PredicateKind :: Ambiguous => {
552+ ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
553+ }
554+ } )
568555 }
569556
570557 // Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
0 commit comments