@@ -421,14 +421,13 @@ impl_stable_hash_for!(enum self::EvaluationResult {
421
421
EvaluatedToErr
422
422
} ) ;
423
423
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 ;
428
427
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
432
431
}
433
432
}
434
433
@@ -573,15 +572,15 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
573
572
assert ! ( self . query_mode == TraitQueryMode :: Standard ) ;
574
573
575
574
let candidate = match self . candidate_from_obligation ( & stack) {
576
- Err ( SelectionError :: Overflow ( _ ) ) =>
575
+ Err ( SelectionError :: Overflow ) =>
577
576
bug ! ( "Overflow should be caught earlier in standard query mode" ) ,
578
577
Err ( e) => { return Err ( e) ; } ,
579
578
Ok ( None ) => { return Ok ( None ) ; } ,
580
579
Ok ( Some ( candidate) ) => candidate
581
580
} ;
582
581
583
582
match self . confirm_candidate ( obligation, candidate) {
584
- Err ( SelectionError :: Overflow ( _ ) ) =>
583
+ Err ( SelectionError :: Overflow ) =>
585
584
bug ! ( "Overflow should be caught earlier in standard query mode" ) ,
586
585
Err ( e) => Err ( e) ,
587
586
Ok ( candidate) => Ok ( Some ( candidate) )
@@ -619,7 +618,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
619
618
/// an `EvaluationResult`.
620
619
pub fn evaluate_obligation_recursively ( & mut self ,
621
620
obligation : & PredicateObligation < ' tcx > )
622
- -> Result < EvaluationResult , OverflowError < ' tcx > >
621
+ -> Result < EvaluationResult , OverflowError >
623
622
{
624
623
self . probe ( |this, _| {
625
624
this. evaluate_predicate_recursively ( TraitObligationStackList :: empty ( ) , obligation)
@@ -632,7 +631,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
632
631
fn evaluate_predicates_recursively < ' a , ' o , I > ( & mut self ,
633
632
stack : TraitObligationStackList < ' o , ' tcx > ,
634
633
predicates : I )
635
- -> Result < EvaluationResult , OverflowError < ' tcx > >
634
+ -> Result < EvaluationResult , OverflowError >
636
635
where I : IntoIterator < Item =& ' a PredicateObligation < ' tcx > > , ' tcx : ' a
637
636
{
638
637
let mut result = EvaluatedToOk ;
@@ -654,7 +653,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
654
653
fn evaluate_predicate_recursively < ' o > ( & mut self ,
655
654
previous_stack : TraitObligationStackList < ' o , ' tcx > ,
656
655
obligation : & PredicateObligation < ' tcx > )
657
- -> Result < EvaluationResult , OverflowError < ' tcx > >
656
+ -> Result < EvaluationResult , OverflowError >
658
657
{
659
658
debug ! ( "evaluate_predicate_recursively({:?})" ,
660
659
obligation) ;
@@ -775,7 +774,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
775
774
fn evaluate_trait_predicate_recursively < ' o > ( & mut self ,
776
775
previous_stack : TraitObligationStackList < ' o , ' tcx > ,
777
776
mut obligation : TraitObligation < ' tcx > )
778
- -> Result < EvaluationResult , OverflowError < ' tcx > >
777
+ -> Result < EvaluationResult , OverflowError >
779
778
{
780
779
debug ! ( "evaluate_trait_predicate_recursively({:?})" ,
781
780
obligation) ;
@@ -810,7 +809,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
810
809
811
810
fn evaluate_stack < ' o > ( & mut self ,
812
811
stack : & TraitObligationStack < ' o , ' tcx > )
813
- -> Result < EvaluationResult , OverflowError < ' tcx > >
812
+ -> Result < EvaluationResult , OverflowError >
814
813
{
815
814
// In intercrate mode, whenever any of the types are unbound,
816
815
// 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> {
921
920
match self . candidate_from_obligation ( stack) {
922
921
Ok ( Some ( c) ) => self . evaluate_candidate ( stack, & c) ,
923
922
Ok ( None ) => Ok ( EvaluatedToAmbig ) ,
924
- Err ( Overflow ( o ) ) => Err ( OverflowError ( o ) ) ,
923
+ Err ( Overflow ) => Err ( OverflowError ) ,
925
924
Err ( ..) => Ok ( EvaluatedToErr )
926
925
}
927
926
}
@@ -960,7 +959,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
960
959
fn evaluate_candidate < ' o > ( & mut self ,
961
960
stack : & TraitObligationStack < ' o , ' tcx > ,
962
961
candidate : & SelectionCandidate < ' tcx > )
963
- -> Result < EvaluationResult , OverflowError < ' tcx > >
962
+ -> Result < EvaluationResult , OverflowError >
964
963
{
965
964
debug ! ( "evaluate_candidate: depth={} candidate={:?}" ,
966
965
stack. obligation. recursion_depth, candidate) ;
@@ -1056,7 +1055,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1056
1055
self . infcx ( ) . report_overflow_error ( & stack. obligation , true ) ;
1057
1056
} ,
1058
1057
TraitQueryMode :: Canonical => {
1059
- return Err ( Overflow ( stack . obligation . clone ( ) ) ) ;
1058
+ return Err ( Overflow ) ;
1060
1059
} ,
1061
1060
}
1062
1061
}
@@ -1144,7 +1143,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1144
1143
. vec
1145
1144
. iter ( )
1146
1145
. map ( |c| self . evaluate_candidate ( stack, & c) )
1147
- . collect :: < Result < Vec < _ > , OverflowError < ' _ > > > ( ) ?
1146
+ . collect :: < Result < Vec < _ > , OverflowError > > ( ) ?
1148
1147
. iter ( )
1149
1148
. all ( |r| !r. may_apply ( ) ) ;
1150
1149
if !candidate_set. ambiguous && no_candidates_apply {
@@ -1224,7 +1223,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1224
1223
evaluation : eval,
1225
1224
} ) ) ,
1226
1225
Ok ( _) => Ok ( None ) ,
1227
- Err ( OverflowError ( o ) ) => Err ( Overflow ( o ) ) ,
1226
+ Err ( OverflowError ) => Err ( Overflow ) ,
1228
1227
} )
1229
1228
. collect ( ) ;
1230
1229
@@ -1621,7 +1620,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1621
1620
fn evaluate_where_clause < ' o > ( & mut self ,
1622
1621
stack : & TraitObligationStack < ' o , ' tcx > ,
1623
1622
where_clause_trait_ref : ty:: PolyTraitRef < ' tcx > )
1624
- -> Result < EvaluationResult , OverflowError < ' tcx > >
1623
+ -> Result < EvaluationResult , OverflowError >
1625
1624
{
1626
1625
self . probe ( move |this, _| {
1627
1626
match this. match_where_clause_trait_ref ( stack. obligation , where_clause_trait_ref) {
0 commit comments