@@ -10,7 +10,7 @@ use crate::traits::project::ProjectAndUnifyResult;
1010use rustc_middle:: mir:: interpret:: ErrorHandled ;
1111use rustc_middle:: ty:: fold:: { TypeFolder , TypeSuperFoldable } ;
1212use rustc_middle:: ty:: visit:: TypeVisitable ;
13- use rustc_middle:: ty:: { PolyTraitRef , Region , RegionVid } ;
13+ use rustc_middle:: ty:: { ImplPolarity , Region , RegionVid } ;
1414
1515use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
1616
@@ -88,19 +88,22 @@ impl<'tcx> AutoTraitFinder<'tcx> {
8888
8989 let trait_ref = tcx. mk_trait_ref ( trait_did, [ ty] ) ;
9090
91- let trait_pred = ty:: Binder :: dummy ( trait_ref) ;
92-
9391 let infcx = tcx. infer_ctxt ( ) . build ( ) ;
9492 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 ] {
9994 let result = selcx. select ( & Obligation :: new (
10095 tcx,
10196 ObligationCause :: dummy ( ) ,
10297 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+ } ) ,
104107 ) ) ;
105108 if let Ok ( Some ( ImplSource :: UserDefined ( _) ) ) = result {
106109 debug ! (
0 commit comments