@@ -50,7 +50,6 @@ use rustc_middle::ty::relate::TypeRelation;
5050use rustc_middle:: ty:: SubstsRef ;
5151use rustc_middle:: ty:: { self , EarlyBinder , PolyProjectionPredicate , ToPolyTraitRef , ToPredicate } ;
5252use rustc_middle:: ty:: { Ty , TyCtxt , TypeFoldable , TypeVisitableExt } ;
53- use rustc_session:: config:: TraitSolver ;
5453use rustc_span:: symbol:: sym;
5554
5655use std:: cell:: { Cell , RefCell } ;
@@ -545,13 +544,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
545544 obligation : & PredicateObligation < ' tcx > ,
546545 ) -> Result < EvaluationResult , OverflowError > {
547546 self . evaluation_probe ( |this| {
548- if this. tcx ( ) . sess . opts . unstable_opts . trait_solver != TraitSolver :: Next {
547+ if this. tcx ( ) . trait_solver_next ( ) {
548+ this. evaluate_predicates_recursively_in_new_solver ( [ obligation. clone ( ) ] )
549+ } else {
549550 this. evaluate_predicate_recursively (
550551 TraitObligationStackList :: empty ( & ProvisionalEvaluationCache :: default ( ) ) ,
551552 obligation. clone ( ) ,
552553 )
553- } else {
554- this. evaluate_predicates_recursively_in_new_solver ( [ obligation. clone ( ) ] )
555554 }
556555 } )
557556 }
@@ -591,7 +590,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
591590 where
592591 I : IntoIterator < Item = PredicateObligation < ' tcx > > + std:: fmt:: Debug ,
593592 {
594- if self . tcx ( ) . sess . opts . unstable_opts . trait_solver != TraitSolver :: Next {
593+ if self . tcx ( ) . trait_solver_next ( ) {
594+ self . evaluate_predicates_recursively_in_new_solver ( predicates)
595+ } else {
595596 let mut result = EvaluatedToOk ;
596597 for obligation in predicates {
597598 let eval = self . evaluate_predicate_recursively ( stack, obligation. clone ( ) ) ?;
@@ -604,8 +605,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
604605 }
605606 }
606607 Ok ( result)
607- } else {
608- self . evaluate_predicates_recursively_in_new_solver ( predicates)
609608 }
610609 }
611610
0 commit comments