Skip to content

Commit

Permalink
Fix the spinach GATs build
Browse files Browse the repository at this point in the history
Broken due to rust-lang/rust#89970
  • Loading branch information
MingweiSamuel committed Nov 8, 2021
1 parent acc12cd commit 049f4d9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
6 changes: 4 additions & 2 deletions spinachflow/src/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ pub trait Collection<K, V> {

type Keys<'s>: Iterator<Item = &'s K>
where
K: 's;
K: 's,
Self: 's;
fn keys(&self) -> Self::Keys<'_>;

type Entries<'s>: Iterator<Item = (&'s K, &'s V)>
where
K: 's,
V: 's;
V: 's,
Self: 's;
fn entries(&self) -> Self::Entries<'_>;
}

Expand Down
4 changes: 3 additions & 1 deletion spinachflow/src/comp/comptrait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output = Result<(), Self::Error>>;
type TickFuture<'s>: Future<Output = Result<(), Self::Error>>
where
Self: 's;
fn tick(&self) -> Self::TickFuture<'_>;
}

Expand Down
9 changes: 6 additions & 3 deletions spinachflow/src/comp/debugcomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ use crate::op::OpDelta;

use super::{Comp, Next};

pub struct DebugComp<O: OpDelta>
pub struct DebugComp<O>
where
O: 'static + OpDelta,
<O::LatRepr as LatticeRepr>::Repr: Debug,
{
op: O,
tag: &'static str,
}

impl<O: OpDelta> DebugComp<O>
impl<O> DebugComp<O>
where
O: 'static + OpDelta,
<O::LatRepr as LatticeRepr>::Repr: Debug,
{
pub fn new(op: O, tag: &'static str) -> Self {
Self { op, tag }
}
}

impl<O: OpDelta> Comp for DebugComp<O>
impl<O> Comp for DebugComp<O>
where
O: 'static + OpDelta,
<O::LatRepr as LatticeRepr>::Repr: Debug,
{
type Error = ();
Expand Down
17 changes: 10 additions & 7 deletions spinachflow/src/comp/dynsplitcomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ use super::{Comp, CompConnector, Next};

pub struct DynSplitComp<O: OpValue + OpDelta, P, C>
where
P: OpDelta,
O: 'static + OpValue + OpDelta,
P: 'static + OpDelta,
P::LatRepr: LatticeRepr<Lattice = SetUnion<C>>,
<P::LatRepr as LatticeRepr>::Repr: IntoIterator<Item = C>,
C: CompConnector<SplitOp<O>>,
C: 'static + CompConnector<SplitOp<O>>,
{
splitter: Splitter<O>,
pipe_op: P,
Expand All @@ -25,10 +26,11 @@ where

impl<O: OpValue + OpDelta, P, C> DynSplitComp<O, P, C>
where
P: OpDelta,
O: 'static + OpValue + OpDelta,
P: 'static + OpDelta,
P::LatRepr: LatticeRepr<Lattice = SetUnion<C>>,
<P::LatRepr as LatticeRepr>::Repr: IntoIterator<Item = C>,
C: CompConnector<SplitOp<O>>,
C: 'static + CompConnector<SplitOp<O>>,
{
pub fn new(splitter: Splitter<O>, pipe_op: P) -> Self {
Self {
Expand All @@ -40,12 +42,13 @@ where
}
}

impl<O: OpValue + OpDelta, P, C> Comp for DynSplitComp<O, P, C>
impl<O, P, C> Comp for DynSplitComp<O, P, C>
where
P: OpDelta,
O: 'static + OpValue + OpDelta,
P: 'static + OpDelta,
P::LatRepr: LatticeRepr<Lattice = SetUnion<C>>,
<P::LatRepr as LatticeRepr>::Repr: IntoIterator<Item = C>,
C: CompConnector<SplitOp<O>>,
C: 'static + CompConnector<SplitOp<O>>,
{
type Error = <C::Comp as Comp>::Error;

Expand Down
15 changes: 12 additions & 3 deletions spinachflow/src/comp/nullcomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ use crate::op::OpDelta;

use super::{Comp, Next};

pub struct NullComp<O: OpDelta> {
pub struct NullComp<O>
where
O: 'static + OpDelta,
{
op: O,
}

impl<O: OpDelta> NullComp<O> {
impl<O> NullComp<O>
where
O: 'static + OpDelta,
{
pub fn new(op: O) -> Self {
Self { op }
}
}

impl<O: OpDelta> Comp for NullComp<O> {
impl<O> Comp for NullComp<O>
where
O: 'static + OpDelta,
{
type Error = ();

type TickFuture<'s> = impl Future<Output = Result<(), Self::Error>>;
Expand Down

0 comments on commit 049f4d9

Please sign in to comment.