@@ -660,8 +660,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
660660 predicate : ty:: Predicate :: Trait ( predicate) ,
661661 .. obligation. clone ( )
662662 } ;
663- let mut selcx = SelectionContext :: new ( self ) ;
664- if selcx. evaluate_obligation ( & unit_obligation) {
663+ if self . predicate_may_hold ( & unit_obligation) {
665664 err. note ( "the trait is implemented for `()`. \
666665 Possibly this error has been caused by changes to \
667666 Rust's type-inference algorithm \
@@ -877,7 +876,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
877876 . count ( ) ;
878877
879878 let mut trait_type = trait_ref. self_ty ( ) ;
880- let mut selcx = SelectionContext :: new ( self ) ;
881879
882880 for refs_remaining in 0 ..refs_number {
883881 if let ty:: TypeVariants :: TyRef ( _, ty:: TypeAndMut { ty : t_type, mutbl : _ } ) =
@@ -891,7 +889,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
891889 obligation. param_env ,
892890 new_trait_ref. to_predicate ( ) ) ;
893891
894- if selcx . evaluate_obligation ( & new_obligation) {
892+ if self . predicate_may_hold ( & new_obligation) {
895893 let sp = self . tcx . sess . codemap ( )
896894 . span_take_while ( span, |c| c. is_whitespace ( ) || * c == '&' ) ;
897895
@@ -1327,7 +1325,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
13271325 cleaned_pred. to_predicate ( )
13281326 ) ;
13291327
1330- selcx . evaluate_obligation ( & obligation)
1328+ self . predicate_may_hold ( & obligation)
13311329 } )
13321330 }
13331331
0 commit comments