@@ -421,14 +421,13 @@ impl_stable_hash_for!(enum self::EvaluationResult {
421421 EvaluatedToErr
422422} ) ;
423423
424- #[ derive( Clone , Debug , PartialEq , Eq ) ]
425- /// Indicates that trait evaluation caused overflow. Stores the obligation
426- /// that hit the recursion limit.
427- pub struct OverflowError < ' tcx > ( pub TraitObligation < ' tcx > ) ;
424+ #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
425+ /// Indicates that trait evaluation caused overflow.
426+ pub struct OverflowError ;
428427
429- impl < ' tcx > From < OverflowError < ' tcx > > for SelectionError < ' tcx > {
430- fn from ( OverflowError ( o ) : OverflowError < ' tcx > ) -> SelectionError < ' tcx > {
431- SelectionError :: Overflow ( o )
428+ impl < ' tcx > From < OverflowError > for SelectionError < ' tcx > {
429+ fn from ( OverflowError : OverflowError ) -> SelectionError < ' tcx > {
430+ SelectionError :: Overflow
432431 }
433432}
434433
@@ -573,15 +572,15 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
573572 assert ! ( self . query_mode == TraitQueryMode :: Standard ) ;
574573
575574 let candidate = match self . candidate_from_obligation ( & stack) {
576- Err ( SelectionError :: Overflow ( _ ) ) =>
575+ Err ( SelectionError :: Overflow ) =>
577576 bug ! ( "Overflow should be caught earlier in standard query mode" ) ,
578577 Err ( e) => { return Err ( e) ; } ,
579578 Ok ( None ) => { return Ok ( None ) ; } ,
580579 Ok ( Some ( candidate) ) => candidate
581580 } ;
582581
583582 match self . confirm_candidate ( obligation, candidate) {
584- Err ( SelectionError :: Overflow ( _ ) ) =>
583+ Err ( SelectionError :: Overflow ) =>
585584 bug ! ( "Overflow should be caught earlier in standard query mode" ) ,
586585 Err ( e) => Err ( e) ,
587586 Ok ( candidate) => Ok ( Some ( candidate) )
@@ -619,7 +618,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
619618 /// an `EvaluationResult`.
620619 pub fn evaluate_obligation_recursively ( & mut self ,
621620 obligation : & PredicateObligation < ' tcx > )
622- -> Result < EvaluationResult , OverflowError < ' tcx > >
621+ -> Result < EvaluationResult , OverflowError >
623622 {
624623 self . probe ( |this, _| {
625624 this. evaluate_predicate_recursively ( TraitObligationStackList :: empty ( ) , obligation)
@@ -632,7 +631,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
632631 fn evaluate_predicates_recursively < ' a , ' o , I > ( & mut self ,
633632 stack : TraitObligationStackList < ' o , ' tcx > ,
634633 predicates : I )
635- -> Result < EvaluationResult , OverflowError < ' tcx > >
634+ -> Result < EvaluationResult , OverflowError >
636635 where I : IntoIterator < Item =& ' a PredicateObligation < ' tcx > > , ' tcx : ' a
637636 {
638637 let mut result = EvaluatedToOk ;
@@ -654,7 +653,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
654653 fn evaluate_predicate_recursively < ' o > ( & mut self ,
655654 previous_stack : TraitObligationStackList < ' o , ' tcx > ,
656655 obligation : & PredicateObligation < ' tcx > )
657- -> Result < EvaluationResult , OverflowError < ' tcx > >
656+ -> Result < EvaluationResult , OverflowError >
658657 {
659658 debug ! ( "evaluate_predicate_recursively({:?})" ,
660659 obligation) ;
@@ -775,7 +774,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
775774 fn evaluate_trait_predicate_recursively < ' o > ( & mut self ,
776775 previous_stack : TraitObligationStackList < ' o , ' tcx > ,
777776 mut obligation : TraitObligation < ' tcx > )
778- -> Result < EvaluationResult , OverflowError < ' tcx > >
777+ -> Result < EvaluationResult , OverflowError >
779778 {
780779 debug ! ( "evaluate_trait_predicate_recursively({:?})" ,
781780 obligation) ;
@@ -810,7 +809,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
810809
811810 fn evaluate_stack < ' o > ( & mut self ,
812811 stack : & TraitObligationStack < ' o , ' tcx > )
813- -> Result < EvaluationResult , OverflowError < ' tcx > >
812+ -> Result < EvaluationResult , OverflowError >
814813 {
815814 // In intercrate mode, whenever any of the types are unbound,
816815 // there can always be an impl. Even if there are no impls in
@@ -921,7 +920,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
921920 match self . candidate_from_obligation ( stack) {
922921 Ok ( Some ( c) ) => self . evaluate_candidate ( stack, & c) ,
923922 Ok ( None ) => Ok ( EvaluatedToAmbig ) ,
924- Err ( Overflow ( o ) ) => Err ( OverflowError ( o ) ) ,
923+ Err ( Overflow ) => Err ( OverflowError ) ,
925924 Err ( ..) => Ok ( EvaluatedToErr )
926925 }
927926 }
@@ -960,7 +959,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
960959 fn evaluate_candidate < ' o > ( & mut self ,
961960 stack : & TraitObligationStack < ' o , ' tcx > ,
962961 candidate : & SelectionCandidate < ' tcx > )
963- -> Result < EvaluationResult , OverflowError < ' tcx > >
962+ -> Result < EvaluationResult , OverflowError >
964963 {
965964 debug ! ( "evaluate_candidate: depth={} candidate={:?}" ,
966965 stack. obligation. recursion_depth, candidate) ;
@@ -1056,7 +1055,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
10561055 self . infcx ( ) . report_overflow_error ( & stack. obligation , true ) ;
10571056 } ,
10581057 TraitQueryMode :: Canonical => {
1059- return Err ( Overflow ( stack . obligation . clone ( ) ) ) ;
1058+ return Err ( Overflow ) ;
10601059 } ,
10611060 }
10621061 }
@@ -1144,7 +1143,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
11441143 . vec
11451144 . iter ( )
11461145 . map ( |c| self . evaluate_candidate ( stack, & c) )
1147- . collect :: < Result < Vec < _ > , OverflowError < ' _ > > > ( ) ?
1146+ . collect :: < Result < Vec < _ > , OverflowError > > ( ) ?
11481147 . iter ( )
11491148 . all ( |r| !r. may_apply ( ) ) ;
11501149 if !candidate_set. ambiguous && no_candidates_apply {
@@ -1224,7 +1223,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
12241223 evaluation : eval,
12251224 } ) ) ,
12261225 Ok ( _) => Ok ( None ) ,
1227- Err ( OverflowError ( o ) ) => Err ( Overflow ( o ) ) ,
1226+ Err ( OverflowError ) => Err ( Overflow ) ,
12281227 } )
12291228 . collect ( ) ;
12301229
@@ -1621,7 +1620,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
16211620 fn evaluate_where_clause < ' o > ( & mut self ,
16221621 stack : & TraitObligationStack < ' o , ' tcx > ,
16231622 where_clause_trait_ref : ty:: PolyTraitRef < ' tcx > )
1624- -> Result < EvaluationResult , OverflowError < ' tcx > >
1623+ -> Result < EvaluationResult , OverflowError >
16251624 {
16261625 self . probe ( move |this, _| {
16271626 match this. match_where_clause_trait_ref ( stack. obligation , where_clause_trait_ref) {
0 commit comments