@@ -58,6 +58,12 @@ impl<'tcx> inspect::ProofTreeVisitor<'tcx> for Select {
5858            ) ) ) ; 
5959        } 
6060
61+         // Don't winnow until `Certainty::Yes` -- we don't need to winnow until 
62+         // codegen, technically, and all goals should hold in codegen. 
63+         if  matches ! ( goal. result( ) . unwrap( ) ,  Certainty :: Maybe ( ..) )  { 
64+             return  ControlFlow :: Break ( Ok ( None ) ) ; 
65+         } 
66+ 
6167        // We need to winnow. See comments on `candidate_should_be_dropped_in_favor_of`. 
6268        let  mut  i = 0 ; 
6369        while  i < candidates. len ( )  { 
@@ -85,8 +91,7 @@ fn candidate_should_be_dropped_in_favor_of<'tcx>(
8591    victim :  & inspect:: InspectCandidate < ' _ ,  ' tcx > , 
8692    other :  & inspect:: InspectCandidate < ' _ ,  ' tcx > , 
8793)  -> bool  { 
88-     // Don't winnow until `Certainty::Yes` -- we don't need to winnow until 
89-     // codegen, technically. 
94+     // codegen, technically, and all goals should hold in codegen. 
9095    if  matches ! ( other. result( ) . unwrap( ) ,  Certainty :: Maybe ( ..) )  { 
9196        return  false ; 
9297    } 
@@ -105,12 +110,14 @@ fn candidate_should_be_dropped_in_favor_of<'tcx>(
105110            bug ! ( "should not have assembled a CoherenceUnknowable candidate" ) 
106111        } 
107112
113+         // In the old trait solver, we arbitrarily choose lower vtable candidates 
114+         // over higher ones. 
115+         ( 
116+             CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object  {  vtable_base :  a } ) , 
117+             CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object  {  vtable_base :  b } ) , 
118+         )  => a >= b, 
108119        // Prefer dyn candidates over non-dyn candidates. This is necessary to 
109120        // handle the unsoundness between `impl<T: ?Sized> Any for T` and `dyn Any: Any`. 
110-         ( 
111-             CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object  {  .. } ) , 
112-             CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object  {  .. } ) , 
113-         )  => false , 
114121        ( 
115122            CandidateSource :: Impl ( _)  | CandidateSource :: ParamEnv ( _)  | CandidateSource :: AliasBound , 
116123            CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object  {  .. } ) , 
0 commit comments