@@ -50,7 +50,6 @@ use rustc_middle::ty::relate::TypeRelation;
50
50
use rustc_middle:: ty:: SubstsRef ;
51
51
use rustc_middle:: ty:: { self , EarlyBinder , PolyProjectionPredicate , ToPolyTraitRef , ToPredicate } ;
52
52
use rustc_middle:: ty:: { Ty , TyCtxt , TypeFoldable , TypeVisitableExt } ;
53
- use rustc_session:: config:: TraitSolver ;
54
53
use rustc_span:: symbol:: sym;
55
54
56
55
use std:: cell:: { Cell , RefCell } ;
@@ -545,13 +544,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
545
544
obligation : & PredicateObligation < ' tcx > ,
546
545
) -> Result < EvaluationResult , OverflowError > {
547
546
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 {
549
550
this. evaluate_predicate_recursively (
550
551
TraitObligationStackList :: empty ( & ProvisionalEvaluationCache :: default ( ) ) ,
551
552
obligation. clone ( ) ,
552
553
)
553
- } else {
554
- this. evaluate_predicates_recursively_in_new_solver ( [ obligation. clone ( ) ] )
555
554
}
556
555
} )
557
556
}
@@ -591,7 +590,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
591
590
where
592
591
I : IntoIterator < Item = PredicateObligation < ' tcx > > + std:: fmt:: Debug ,
593
592
{
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 {
595
596
let mut result = EvaluatedToOk ;
596
597
for obligation in predicates {
597
598
let eval = self . evaluate_predicate_recursively ( stack, obligation. clone ( ) ) ?;
@@ -604,8 +605,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
604
605
}
605
606
}
606
607
Ok ( result)
607
- } else {
608
- self . evaluate_predicates_recursively_in_new_solver ( predicates)
609
608
}
610
609
}
611
610
0 commit comments