Skip to content

Commit 0767719

Browse files
committed
Test and relax bounds
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
1 parent 7811855 commit 0767719

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
@@ -79,7 +79,7 @@ impl<T, C: Container, P: Push<BundleCore<T, C>>> BufferCore<T, C, P> where T: Eq
7979
}
8080
}
8181

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

124-
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 {
124+
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 {
125125
/// Provides one record at the time specified by the `Session`.
126126
#[inline]
127127
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)