@@ -18,9 +18,6 @@ use super::const_evaluatable;
18
18
use super :: project:: { self , ProjectAndUnifyResult } ;
19
19
use super :: select:: SelectionContext ;
20
20
use super :: wf;
21
- use super :: CodeAmbiguity ;
22
- use super :: CodeProjectionError ;
23
- use super :: CodeSelectionError ;
24
21
use super :: EvaluationResult ;
25
22
use super :: PredicateObligation ;
26
23
use super :: Unimplemented ;
@@ -135,7 +132,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
135
132
_infcx : & InferCtxt < ' tcx > ,
136
133
) -> Vec < FulfillmentError < ' tcx > > {
137
134
self . predicates
138
- . to_errors ( CodeAmbiguity { overflow : false } )
135
+ . to_errors ( FulfillmentErrorCode :: Ambiguity { overflow : false } )
139
136
. into_iter ( )
140
137
. map ( to_fulfillment_error)
141
138
. collect ( )
@@ -409,7 +406,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
409
406
410
407
ty:: PredicateKind :: ObjectSafe ( trait_def_id) => {
411
408
if !self . selcx . tcx ( ) . check_is_object_safe ( trait_def_id) {
412
- ProcessResult :: Error ( CodeSelectionError ( Unimplemented ) )
409
+ ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError ( Unimplemented ) )
413
410
} else {
414
411
ProcessResult :: Changed ( vec ! [ ] )
415
412
}
@@ -480,7 +477,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
480
477
Ok ( Err ( err) ) => {
481
478
let expected_found =
482
479
ExpectedFound :: new ( subtype. a_is_expected , subtype. a , subtype. b ) ;
483
- ProcessResult :: Error ( FulfillmentErrorCode :: CodeSubtypeError (
480
+ ProcessResult :: Error ( FulfillmentErrorCode :: SubtypeError (
484
481
expected_found,
485
482
err,
486
483
) )
@@ -503,7 +500,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
503
500
Ok ( Ok ( ok) ) => ProcessResult :: Changed ( mk_pending ( ok. obligations ) ) ,
504
501
Ok ( Err ( err) ) => {
505
502
let expected_found = ExpectedFound :: new ( false , coerce. a , coerce. b ) ;
506
- ProcessResult :: Error ( FulfillmentErrorCode :: CodeSubtypeError (
503
+ ProcessResult :: Error ( FulfillmentErrorCode :: SubtypeError (
507
504
expected_found,
508
505
err,
509
506
) )
@@ -529,7 +526,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
529
526
Err (
530
527
e @ NotConstEvaluatable :: MentionsParam
531
528
| e @ NotConstEvaluatable :: Error ( _) ,
532
- ) => ProcessResult :: Error ( CodeSelectionError (
529
+ ) => ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError (
533
530
SelectionError :: NotConstEvaluatable ( e) ,
534
531
) ) ,
535
532
}
@@ -618,28 +615,30 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
618
615
Ok ( inf_ok) => {
619
616
ProcessResult :: Changed ( mk_pending ( inf_ok. into_obligations ( ) ) )
620
617
}
621
- Err ( err) => ProcessResult :: Error (
622
- FulfillmentErrorCode :: CodeConstEquateError (
618
+ Err ( err) => {
619
+ ProcessResult :: Error ( FulfillmentErrorCode :: ConstEquateError (
623
620
ExpectedFound :: new ( true , c1, c2) ,
624
621
err,
625
- ) ,
626
- ) ,
622
+ ) )
623
+ }
627
624
}
628
625
}
629
626
( 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
+ }
635
634
( Err ( ErrorHandled :: TooGeneric ( _) ) , _)
636
635
| ( _, Err ( ErrorHandled :: TooGeneric ( _) ) ) => {
637
636
if c1. has_non_region_infer ( ) || c2. has_non_region_infer ( ) {
638
637
ProcessResult :: Unchanged
639
638
} else {
640
639
// Two different constants using generic parameters ~> error.
641
640
let expected_found = ExpectedFound :: new ( true , c1, c2) ;
642
- ProcessResult :: Error ( FulfillmentErrorCode :: CodeConstEquateError (
641
+ ProcessResult :: Error ( FulfillmentErrorCode :: ConstEquateError (
643
642
expected_found,
644
643
TypeError :: ConstMismatch ( expected_found) ,
645
644
) )
@@ -654,7 +653,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
654
653
ty,
655
654
) {
656
655
Ok ( inf_ok) => ProcessResult :: Changed ( mk_pending ( inf_ok. into_obligations ( ) ) ) ,
657
- Err ( _) => ProcessResult :: Error ( FulfillmentErrorCode :: CodeSelectionError (
656
+ Err ( _) => ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError (
658
657
SelectionError :: Unimplemented ,
659
658
) ) ,
660
659
}
@@ -677,7 +676,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
677
676
Ok ( ( ) )
678
677
} else {
679
678
let cycle: Vec < _ > = cycle. map ( |c| c. obligation . clone ( ) ) . collect ( ) ;
680
- Err ( FulfillmentErrorCode :: CodeCycle ( cycle) )
679
+ Err ( FulfillmentErrorCode :: Cycle ( cycle) )
681
680
}
682
681
}
683
682
}
@@ -732,7 +731,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
732
731
Err ( selection_err) => {
733
732
debug ! ( "selecting trait at depth {} yielded Err" , obligation. recursion_depth) ;
734
733
735
- ProcessResult :: Error ( CodeSelectionError ( selection_err) )
734
+ ProcessResult :: Error ( FulfillmentErrorCode :: SelectionError ( selection_err) )
736
735
}
737
736
}
738
737
}
@@ -784,7 +783,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
784
783
project_obligation. with( tcx, project_obligation. predicate) ,
785
784
] ) ) ,
786
785
ProjectAndUnifyResult :: MismatchedProjectionTypes ( e) => {
787
- ProcessResult :: Error ( CodeProjectionError ( e) )
786
+ ProcessResult :: Error ( FulfillmentErrorCode :: ProjectionError ( e) )
788
787
}
789
788
}
790
789
}
0 commit comments