From 749dec64519b5bdfe688cb945eeee5afd6ab68d0 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 19 Sep 2022 20:57:37 -0500 Subject: [PATCH] Make `OUT` an associated type instead of a generic parameter This avoids toil when changing other functions in `ObligationForest` to take an `OUT` parameter. --- compiler/rustc_data_structures/src/obligation_forest/mod.rs | 4 ++++ compiler/rustc_data_structures/src/obligation_forest/tests.rs | 1 + compiler/rustc_trait_selection/src/traits/fulfill.rs | 1 + 3 files changed, 6 insertions(+) diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index e351b650a16..f2d72647a66 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -95,6 +95,10 @@ pub trait ForestObligation: Clone + Debug { pub trait ObligationProcessor { type Obligation: ForestObligation; type Error: Debug; + type OUT: OutcomeTrait< + Obligation = Self::Obligation, + Error = Error, + >; fn needs_process_obligation(&self, obligation: &Self::Obligation) -> bool; diff --git a/compiler/rustc_data_structures/src/obligation_forest/tests.rs b/compiler/rustc_data_structures/src/obligation_forest/tests.rs index e2991aae174..f2a04796691 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/tests.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/tests.rs @@ -64,6 +64,7 @@ where { type Obligation = O; type Error = E; + type OUT = TestOutcome; fn needs_process_obligation(&self, _obligation: &Self::Obligation) -> bool { true diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 3763a98c488..0ea2b6ce885 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -224,6 +224,7 @@ fn mk_pending(os: Vec>) -> Vec ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { type Obligation = PendingPredicateObligation<'tcx>; type Error = FulfillmentErrorCode<'tcx>; + type OUT = Outcome; /// Identifies whether a predicate obligation needs processing. ///