@@ -18,9 +18,6 @@ use super::const_evaluatable;
1818use super :: project:: { self , ProjectAndUnifyResult } ;
1919use super :: select:: SelectionContext ;
2020use super :: wf;
21- use super :: CodeAmbiguity ;
22- use super :: CodeProjectionError ;
23- use super :: CodeSelectionError ;
2421use super :: EvaluationResult ;
2522use super :: PredicateObligation ;
2623use super :: Unimplemented ;
@@ -135,7 +132,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
135132 _infcx : & InferCtxt < ' tcx > ,
136133 ) -> Vec < FulfillmentError < ' tcx > > {
137134 self . predicates
138- . to_errors ( CodeAmbiguity { overflow : false } )
135+ . to_errors ( FulfillmentErrorCode :: Ambiguity { overflow : false } )
139136 . into_iter ( )
140137 . map ( to_fulfillment_error)
141138 . collect ( )
@@ -409,7 +406,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
409406
410407 ty:: PredicateKind :: ObjectSafe ( trait_def_id) => {
411408 if !self . selcx . tcx ( ) . check_is_object_safe ( trait_def_id) {
412- ProcessResult :: Error ( CodeSelectionError ( Unimplemented ) )
409+ ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError ( Unimplemented ) )
413410 } else {
414411 ProcessResult :: Changed ( vec ! [ ] )
415412 }
@@ -480,7 +477,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
480477 Ok ( Err ( err) ) => {
481478 let expected_found =
482479 ExpectedFound :: new ( subtype. a_is_expected , subtype. a , subtype. b ) ;
483- ProcessResult :: Error ( FulfillmentErrorCode :: CodeSubtypeError (
480+ ProcessResult :: Error ( FulfillmentErrorCode :: SubtypeError (
484481 expected_found,
485482 err,
486483 ) )
@@ -503,7 +500,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
503500 Ok ( Ok ( ok) ) => ProcessResult :: Changed ( mk_pending ( ok. obligations ) ) ,
504501 Ok ( Err ( err) ) => {
505502 let expected_found = ExpectedFound :: new ( false , coerce. a , coerce. b ) ;
506- ProcessResult :: Error ( FulfillmentErrorCode :: CodeSubtypeError (
503+ ProcessResult :: Error ( FulfillmentErrorCode :: SubtypeError (
507504 expected_found,
508505 err,
509506 ) )
@@ -529,7 +526,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
529526 Err (
530527 e @ NotConstEvaluatable :: MentionsParam
531528 | e @ NotConstEvaluatable :: Error ( _) ,
532- ) => ProcessResult :: Error ( CodeSelectionError (
529+ ) => ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError (
533530 SelectionError :: NotConstEvaluatable ( e) ,
534531 ) ) ,
535532 }
@@ -618,28 +615,30 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
618615 Ok ( inf_ok) => {
619616 ProcessResult :: Changed ( mk_pending ( inf_ok. into_obligations ( ) ) )
620617 }
621- Err ( err) => ProcessResult :: Error (
622- FulfillmentErrorCode :: CodeConstEquateError (
618+ Err ( err) => {
619+ ProcessResult :: Error ( FulfillmentErrorCode :: ConstEquateError (
623620 ExpectedFound :: new ( true , c1, c2) ,
624621 err,
625- ) ,
626- ) ,
622+ ) )
623+ }
627624 }
628625 }
629626 ( Err ( ErrorHandled :: Reported ( reported, _) ) , _)
630- | ( _, Err ( ErrorHandled :: Reported ( reported, _) ) ) => ProcessResult :: Error (
631- CodeSelectionError ( SelectionError :: NotConstEvaluatable (
632- NotConstEvaluatable :: Error ( reported. into ( ) ) ,
633- ) ) ,
634- ) ,
627+ | ( _, Err ( ErrorHandled :: Reported ( reported, _) ) ) => {
628+ ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError (
629+ SelectionError :: NotConstEvaluatable ( NotConstEvaluatable :: Error (
630+ reported. into ( ) ,
631+ ) ) ,
632+ ) )
633+ }
635634 ( Err ( ErrorHandled :: TooGeneric ( _) ) , _)
636635 | ( _, Err ( ErrorHandled :: TooGeneric ( _) ) ) => {
637636 if c1. has_non_region_infer ( ) || c2. has_non_region_infer ( ) {
638637 ProcessResult :: Unchanged
639638 } else {
640639 // Two different constants using generic parameters ~> error.
641640 let expected_found = ExpectedFound :: new ( true , c1, c2) ;
642- ProcessResult :: Error ( FulfillmentErrorCode :: CodeConstEquateError (
641+ ProcessResult :: Error ( FulfillmentErrorCode :: ConstEquateError (
643642 expected_found,
644643 TypeError :: ConstMismatch ( expected_found) ,
645644 ) )
@@ -654,7 +653,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
654653 ty,
655654 ) {
656655 Ok ( inf_ok) => ProcessResult :: Changed ( mk_pending ( inf_ok. into_obligations ( ) ) ) ,
657- Err ( _) => ProcessResult :: Error ( FulfillmentErrorCode :: CodeSelectionError (
656+ Err ( _) => ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError (
658657 SelectionError :: Unimplemented ,
659658 ) ) ,
660659 }
@@ -677,7 +676,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
677676 Ok ( ( ) )
678677 } else {
679678 let cycle: Vec < _ > = cycle. map ( |c| c. obligation . clone ( ) ) . collect ( ) ;
680- Err ( FulfillmentErrorCode :: CodeCycle ( cycle) )
679+ Err ( FulfillmentErrorCode :: Cycle ( cycle) )
681680 }
682681 }
683682}
@@ -732,7 +731,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
732731 Err ( selection_err) => {
733732 debug ! ( "selecting trait at depth {} yielded Err" , obligation. recursion_depth) ;
734733
735- ProcessResult :: Error ( CodeSelectionError ( selection_err) )
734+ ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError ( selection_err) )
736735 }
737736 }
738737 }
@@ -784,7 +783,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
784783 project_obligation. with( tcx, project_obligation. predicate) ,
785784 ] ) ) ,
786785 ProjectAndUnifyResult :: MismatchedProjectionTypes ( e) => {
787- ProcessResult :: Error ( CodeProjectionError ( e) )
786+ ProcessResult :: Error ( FulfillmentErrorCode :: ProjectionError ( e) )
788787 }
789788 }
790789 }
0 commit comments