@@ -1553,7 +1553,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1553
1553
/// See the comment for "SelectionCandidate" for more details.
1554
1554
fn candidate_should_be_dropped_in_favor_of (
1555
1555
& mut self ,
1556
- sized_predicate : bool ,
1557
1556
victim : & EvaluatedCandidate < ' tcx > ,
1558
1557
other : & EvaluatedCandidate < ' tcx > ,
1559
1558
needs_infer : bool ,
@@ -1625,16 +1624,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1625
1624
// Drop otherwise equivalent non-const fn pointer candidates
1626
1625
( FnPointerCandidate { .. } , FnPointerCandidate { is_const : false } ) => true ,
1627
1626
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
-
1638
1627
// Global bounds from the where clause should be ignored
1639
1628
// here (see issue #50825). Otherwise, we have a where
1640
1629
// clause so don't go around looking for impls.
@@ -1650,8 +1639,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1650
1639
| BuiltinUnsizeCandidate
1651
1640
| TraitUpcastingUnsizeCandidate ( _)
1652
1641
| BuiltinCandidate { .. }
1653
- | TraitAliasCandidate ( ..) ,
1642
+ | TraitAliasCandidate ( ..)
1643
+ | ObjectCandidate ( _)
1644
+ | ProjectionCandidate ( _) ,
1654
1645
) => !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
+ }
1655
1651
(
1656
1652
ImplCandidate ( _)
1657
1653
| ClosureCandidate
0 commit comments