@@ -1553,7 +1553,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15531553 /// See the comment for "SelectionCandidate" for more details.
15541554 fn candidate_should_be_dropped_in_favor_of (
15551555 & mut self ,
1556- sized_predicate : bool ,
15571556 victim : & EvaluatedCandidate < ' tcx > ,
15581557 other : & EvaluatedCandidate < ' tcx > ,
15591558 needs_infer : bool ,
@@ -1625,16 +1624,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16251624 // Drop otherwise equivalent non-const fn pointer candidates
16261625 ( FnPointerCandidate { .. } , FnPointerCandidate { is_const : false } ) => true ,
16271626
1628- // If obligation is a sized predicate or the where-clause bound is
1629- // global, prefer the projection or object candidate. See issue
1630- // #50825 and #89352.
1631- ( ObjectCandidate ( _) | ProjectionCandidate ( _) , ParamCandidate ( ref cand) ) => {
1632- sized_predicate || is_global ( cand)
1633- }
1634- ( ParamCandidate ( ref cand) , ObjectCandidate ( _) | ProjectionCandidate ( _) ) => {
1635- !( sized_predicate || is_global ( cand) )
1636- }
1637-
16381627 // Global bounds from the where clause should be ignored
16391628 // here (see issue #50825). Otherwise, we have a where
16401629 // clause so don't go around looking for impls.
@@ -1650,8 +1639,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16501639 | BuiltinUnsizeCandidate
16511640 | TraitUpcastingUnsizeCandidate ( _)
16521641 | BuiltinCandidate { .. }
1653- | TraitAliasCandidate ( ..) ,
1642+ | TraitAliasCandidate ( ..)
1643+ | ObjectCandidate ( _)
1644+ | ProjectionCandidate ( _) ,
16541645 ) => !is_global ( cand) ,
1646+ ( ObjectCandidate ( _) | ProjectionCandidate ( _) , ParamCandidate ( ref cand) ) => {
1647+ // Prefer these to a global where-clause bound
1648+ // (see issue #50825).
1649+ is_global ( cand)
1650+ }
16551651 (
16561652 ImplCandidate ( _)
16571653 | ClosureCandidate
0 commit comments