Make OUT an associated type instead of a generic parameter

This avoids toil when changing other functions in `ObligationForest` to take an `OUT` parameter.
This commit is contained in:
Joshua Nelson 2022-09-19 20:57:37 -05:00
parent 5922d6cf60
commit 749dec6451
3 changed files with 6 additions and 0 deletions

View File

@ -95,6 +95,10 @@ pub trait ForestObligation: Clone + Debug {
pub trait ObligationProcessor { pub trait ObligationProcessor {
type Obligation: ForestObligation; type Obligation: ForestObligation;
type Error: Debug; type Error: Debug;
type OUT: OutcomeTrait<
Obligation = Self::Obligation,
Error = Error<Self::Obligation, Self::Error>,
>;
fn needs_process_obligation(&self, obligation: &Self::Obligation) -> bool; fn needs_process_obligation(&self, obligation: &Self::Obligation) -> bool;

View File

@ -64,6 +64,7 @@ where
{ {
type Obligation = O; type Obligation = O;
type Error = E; type Error = E;
type OUT = TestOutcome<O, E>;
fn needs_process_obligation(&self, _obligation: &Self::Obligation) -> bool { fn needs_process_obligation(&self, _obligation: &Self::Obligation) -> bool {
true true

View File

@ -224,6 +224,7 @@ fn mk_pending(os: Vec<PredicateObligation<'_>>) -> Vec<PendingPredicateObligatio
impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
type Obligation = PendingPredicateObligation<'tcx>; type Obligation = PendingPredicateObligation<'tcx>;
type Error = FulfillmentErrorCode<'tcx>; type Error = FulfillmentErrorCode<'tcx>;
type OUT = Outcome<Self::Obligation, Self::Error>;
/// Identifies whether a predicate obligation needs processing. /// Identifies whether a predicate obligation needs processing.
/// ///