@@ -126,10 +126,7 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
126126    } 
127127
128128    /// Attempts to select obligations using `selcx`. 
129-      fn  select ( 
130-         & mut  self , 
131-         selcx :  & mut  SelectionContext < ' a ,  ' tcx > , 
132-     )  -> Result < ( ) ,  Vec < FulfillmentError < ' tcx > > >  { 
129+      fn  select ( & mut  self ,  selcx :  & mut  SelectionContext < ' a ,  ' tcx > )  -> Vec < FulfillmentError < ' tcx > >  { 
133130        let  span = debug_span ! ( "select" ,  obligation_forest_size = ?self . predicates. len( ) ) ; 
134131        let  _enter = span. enter ( ) ; 
135132
@@ -163,7 +160,7 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
163160            errors. len( ) 
164161        ) ; 
165162
166-         if   errors. is_empty ( )   {   Ok ( ( ) )   }   else   {   Err ( errors )   } 
163+         errors
167164    } 
168165} 
169166
@@ -223,41 +220,36 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
223220            . register_obligation ( PendingPredicateObligation  {  obligation,  stalled_on :  vec ! [ ]  } ) ; 
224221    } 
225222
226-     fn  select_all_or_error ( 
227-         & mut  self , 
228-         infcx :  & InferCtxt < ' _ ,  ' tcx > , 
229-     )  -> Result < ( ) ,  Vec < FulfillmentError < ' tcx > > >  { 
230-         self . select_where_possible ( infcx) ?; 
231- 
232-         let  errors:  Vec < _ >  = self 
233-             . predicates 
234-             . to_errors ( CodeAmbiguity ) 
235-             . into_iter ( ) 
236-             . map ( to_fulfillment_error) 
237-             . collect ( ) ; 
238-         if  errors. is_empty ( )  {  Ok ( ( ) )  }  else  {  Err ( errors)  } 
223+     fn  select_all_or_error ( & mut  self ,  infcx :  & InferCtxt < ' _ ,  ' tcx > )  -> Vec < FulfillmentError < ' tcx > >  { 
224+         { 
225+             let  errors = self . select_where_possible ( infcx) ; 
226+             if  !errors. is_empty ( )  { 
227+                 return  errors; 
228+             } 
229+         } 
230+ 
231+         self . predicates . to_errors ( CodeAmbiguity ) . into_iter ( ) . map ( to_fulfillment_error) . collect ( ) 
239232    } 
240233
241234    fn  select_all_with_constness_or_error ( 
242235        & mut  self , 
243236        infcx :  & InferCtxt < ' _ ,  ' tcx > , 
244237        constness :  rustc_hir:: Constness , 
245-     )  -> Result < ( ) ,  Vec < FulfillmentError < ' tcx > > >  { 
246-         self . select_with_constness_where_possible ( infcx,  constness) ?; 
247- 
248-         let  errors:  Vec < _ >  = self 
249-             . predicates 
250-             . to_errors ( CodeAmbiguity ) 
251-             . into_iter ( ) 
252-             . map ( to_fulfillment_error) 
253-             . collect ( ) ; 
254-         if  errors. is_empty ( )  {  Ok ( ( ) )  }  else  {  Err ( errors)  } 
238+     )  -> Vec < FulfillmentError < ' tcx > >  { 
239+         { 
240+             let  errors = self . select_with_constness_where_possible ( infcx,  constness) ; 
241+             if  !errors. is_empty ( )  { 
242+                 return  errors; 
243+             } 
244+         } 
245+ 
246+         self . predicates . to_errors ( CodeAmbiguity ) . into_iter ( ) . map ( to_fulfillment_error) . collect ( ) 
255247    } 
256248
257249    fn  select_where_possible ( 
258250        & mut  self , 
259251        infcx :  & InferCtxt < ' _ ,  ' tcx > , 
260-     )  -> Result < ( ) ,   Vec < FulfillmentError < ' tcx > > >  { 
252+     )  -> Vec < FulfillmentError < ' tcx > >  { 
261253        let  mut  selcx = SelectionContext :: new ( infcx) ; 
262254        self . select ( & mut  selcx) 
263255    } 
@@ -266,7 +258,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
266258        & mut  self , 
267259        infcx :  & InferCtxt < ' _ ,  ' tcx > , 
268260        constness :  hir:: Constness , 
269-     )  -> Result < ( ) ,   Vec < FulfillmentError < ' tcx > > >  { 
261+     )  -> Vec < FulfillmentError < ' tcx > >  { 
270262        let  mut  selcx = SelectionContext :: with_constness ( infcx,  constness) ; 
271263        self . select ( & mut  selcx) 
272264    } 
0 commit comments