Skip to content

Commit 63c378c

Browse files
committed
Test and relax bounds
Signed-off-by: Moritz Hoffmann <[email protected]>
1 parent 06ae60f commit 63c378c

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

timely/src/dataflow/channels/pushers/buffer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<T, C: Container, P: Push<BundleCore<T, C>>> BufferCore<T, C, P> where T: Eq
8181
}
8282
}
8383

84-
impl<T, D: Data, P: Push<Bundle<T, D>>> Buffer<T, D, P> where T: Eq+Clone {
84+
impl<T, D: 'static, P: Push<Bundle<T, D>>> Buffer<T, D, P> where T: Eq+Clone {
8585
// internal method for use by `Session`.
8686
#[inline]
8787
fn give(&mut self, data: D) {
@@ -123,7 +123,7 @@ impl<'a, T, C: Container, P: Push<BundleCore<T, C>>+'a> Session<'a, T, C, P> wh
123123
}
124124
}
125125

126-
impl<'a, T, D: Data, P: Push<BundleCore<T, Vec<D>>>+'a> Session<'a, T, Vec<D>, P> where T: Eq+Clone+'a, D: 'a {
126+
impl<'a, T, D: 'static, P: Push<BundleCore<T, Vec<D>>>+'a> Session<'a, T, Vec<D>, P> where T: Eq+Clone+'a, D: 'a {
127127
/// Provides one record at the time specified by the `Session`.
128128
#[inline]
129129
pub fn give(&mut self, data: D) {

timely/src/dataflow/operators/to_stream.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::progress::Timestamp;
1212
use crate::Data;
1313

1414
/// Converts to a timely `Stream`.
15-
pub trait ToStream<T: Timestamp, D: Data> {
15+
pub trait ToStream<T: Timestamp, D> {
1616
/// Converts to a timely `Stream`.
1717
///
1818
/// # Examples
@@ -32,7 +32,7 @@ pub trait ToStream<T: Timestamp, D: Data> {
3232
fn to_stream<S: Scope<Timestamp=T>>(self, scope: &mut S) -> OwnedStream<S, Vec<D>>;
3333
}
3434

35-
impl<T: Timestamp, I: IntoIterator+'static> ToStream<T, I::Item> for I where I::Item: Data {
35+
impl<T: Timestamp, I: IntoIterator+'static> ToStream<T, I::Item> for I {
3636
fn to_stream<S: Scope<Timestamp=T>>(self, scope: &mut S) -> OwnedStream<S, Vec<I::Item>> {
3737

3838
source(scope, "ToStream", |capability, info| {

timely/src/dataflow/stream.rs

+25
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,28 @@ where
126126
.finish()
127127
}
128128
}
129+
130+
#[cfg(test)]
131+
mod tests {
132+
use crate::dataflow::channels::pact::Pipeline;
133+
use crate::dataflow::operators::{Operator, ToStream};
134+
135+
#[derive(Debug, Eq, PartialEq)]
136+
struct NotClone;
137+
138+
#[test]
139+
fn test_non_clone_stream() {
140+
crate::example(|scope| {
141+
let _ = vec![NotClone]
142+
.to_stream(scope)
143+
.sink(Pipeline, "check non-clone", |input| {
144+
while let Some((_time, data)) = input.next() {
145+
for datum in data.iter() {
146+
assert_eq!(datum, &NotClone);
147+
}
148+
}
149+
});
150+
});
151+
}
152+
153+
}

0 commit comments

Comments
 (0)