From 049f4d98eddabf17ab086b46a005fc78e430eb1d Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Mon, 8 Nov 2021 10:19:16 -0800 Subject: [PATCH] Fix the spinach GATs build Broken due to https://github.com/rust-lang/rust/pull/89970 --- spinachflow/src/collections.rs | 6 ++++-- spinachflow/src/comp/comptrait.rs | 4 +++- spinachflow/src/comp/debugcomp.rs | 9 ++++++--- spinachflow/src/comp/dynsplitcomp.rs | 17 ++++++++++------- spinachflow/src/comp/nullcomp.rs | 15 ++++++++++++--- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/spinachflow/src/collections.rs b/spinachflow/src/collections.rs index 066759c592ad..631e52c5111d 100644 --- a/spinachflow/src/collections.rs +++ b/spinachflow/src/collections.rs @@ -27,13 +27,15 @@ pub trait Collection { type Keys<'s>: Iterator where - K: 's; + K: 's, + Self: 's; fn keys(&self) -> Self::Keys<'_>; type Entries<'s>: Iterator where K: 's, - V: 's; + V: 's, + Self: 's; fn entries(&self) -> Self::Entries<'_>; } diff --git a/spinachflow/src/comp/comptrait.rs b/spinachflow/src/comp/comptrait.rs index 0299564a5934..aa8191ff4378 100644 --- a/spinachflow/src/comp/comptrait.rs +++ b/spinachflow/src/comp/comptrait.rs @@ -28,7 +28,9 @@ impl<'s, C: Comp + ?Sized> Future for CompRunFuture<'s, C> { pub trait Comp { type Error: std::fmt::Debug; - type TickFuture<'s>: Future>; + type TickFuture<'s>: Future> + where + Self: 's; fn tick(&self) -> Self::TickFuture<'_>; } diff --git a/spinachflow/src/comp/debugcomp.rs b/spinachflow/src/comp/debugcomp.rs index 0e9e9ac943a5..a88ba6c53511 100644 --- a/spinachflow/src/comp/debugcomp.rs +++ b/spinachflow/src/comp/debugcomp.rs @@ -6,16 +6,18 @@ use crate::op::OpDelta; use super::{Comp, Next}; -pub struct DebugComp +pub struct DebugComp where + O: 'static + OpDelta, ::Repr: Debug, { op: O, tag: &'static str, } -impl DebugComp +impl DebugComp where + O: 'static + OpDelta, ::Repr: Debug, { pub fn new(op: O, tag: &'static str) -> Self { @@ -23,8 +25,9 @@ where } } -impl Comp for DebugComp +impl Comp for DebugComp where + O: 'static + OpDelta, ::Repr: Debug, { type Error = (); diff --git a/spinachflow/src/comp/dynsplitcomp.rs b/spinachflow/src/comp/dynsplitcomp.rs index 957bcfea75d0..2c6a36fad86f 100644 --- a/spinachflow/src/comp/dynsplitcomp.rs +++ b/spinachflow/src/comp/dynsplitcomp.rs @@ -12,10 +12,11 @@ use super::{Comp, CompConnector, Next}; pub struct DynSplitComp where - P: OpDelta, + O: 'static + OpValue + OpDelta, + P: 'static + OpDelta, P::LatRepr: LatticeRepr>, ::Repr: IntoIterator, - C: CompConnector>, + C: 'static + CompConnector>, { splitter: Splitter, pipe_op: P, @@ -25,10 +26,11 @@ where impl DynSplitComp where - P: OpDelta, + O: 'static + OpValue + OpDelta, + P: 'static + OpDelta, P::LatRepr: LatticeRepr>, ::Repr: IntoIterator, - C: CompConnector>, + C: 'static + CompConnector>, { pub fn new(splitter: Splitter, pipe_op: P) -> Self { Self { @@ -40,12 +42,13 @@ where } } -impl Comp for DynSplitComp +impl Comp for DynSplitComp where - P: OpDelta, + O: 'static + OpValue + OpDelta, + P: 'static + OpDelta, P::LatRepr: LatticeRepr>, ::Repr: IntoIterator, - C: CompConnector>, + C: 'static + CompConnector>, { type Error = ::Error; diff --git a/spinachflow/src/comp/nullcomp.rs b/spinachflow/src/comp/nullcomp.rs index c067fdd0d608..745d464bac09 100644 --- a/spinachflow/src/comp/nullcomp.rs +++ b/spinachflow/src/comp/nullcomp.rs @@ -4,17 +4,26 @@ use crate::op::OpDelta; use super::{Comp, Next}; -pub struct NullComp { +pub struct NullComp +where + O: 'static + OpDelta, +{ op: O, } -impl NullComp { +impl NullComp +where + O: 'static + OpDelta, +{ pub fn new(op: O) -> Self { Self { op } } } -impl Comp for NullComp { +impl Comp for NullComp +where + O: 'static + OpDelta, +{ type Error = (); type TickFuture<'s> = impl Future>;