@@ -10,7 +10,7 @@ use crate::traits::project::ProjectAndUnifyResult;
10
10
use rustc_middle:: mir:: interpret:: ErrorHandled ;
11
11
use rustc_middle:: ty:: fold:: { TypeFolder , TypeSuperFoldable } ;
12
12
use rustc_middle:: ty:: visit:: TypeVisitable ;
13
- use rustc_middle:: ty:: { PolyTraitRef , Region , RegionVid } ;
13
+ use rustc_middle:: ty:: { ImplPolarity , Region , RegionVid } ;
14
14
15
15
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
16
16
@@ -88,19 +88,22 @@ impl<'tcx> AutoTraitFinder<'tcx> {
88
88
89
89
let trait_ref = tcx. mk_trait_ref ( trait_did, [ ty] ) ;
90
90
91
- let trait_pred = ty:: Binder :: dummy ( trait_ref) ;
92
-
93
91
let infcx = tcx. infer_ctxt ( ) . build ( ) ;
94
92
let mut selcx = SelectionContext :: new ( & infcx) ;
95
- for f in [
96
- PolyTraitRef :: to_poly_trait_predicate,
97
- PolyTraitRef :: to_poly_trait_predicate_negative_polarity,
98
- ] {
93
+ for polarity in [ true , false ] {
99
94
let result = selcx. select ( & Obligation :: new (
100
95
tcx,
101
96
ObligationCause :: dummy ( ) ,
102
97
orig_env,
103
- f ( & trait_pred) ,
98
+ ty:: Binder :: dummy ( ty:: TraitPredicate {
99
+ trait_ref,
100
+ constness : ty:: BoundConstness :: NotConst ,
101
+ polarity : if polarity {
102
+ ImplPolarity :: Positive
103
+ } else {
104
+ ImplPolarity :: Negative
105
+ } ,
106
+ } ) ,
104
107
) ) ;
105
108
if let Ok ( Some ( ImplSource :: UserDefined ( _) ) ) = result {
106
109
debug ! (
0 commit comments