File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ thread_local!(static STORE: Cell<*mut ()> = Cell::new(ptr::null_mut()));
33
33
34
34
// ===== impl Sender =====
35
35
36
- impl < T : Unpin > Sender < T > {
36
+ impl < T > Sender < T > {
37
37
pub fn send ( & mut self , value : T ) -> impl Future < Output = ( ) > {
38
38
Send { value : Some ( value) }
39
39
}
@@ -43,7 +43,9 @@ struct Send<T> {
43
43
value : Option < T > ,
44
44
}
45
45
46
- impl < T : Unpin > Future for Send < T > {
46
+ impl < T > Unpin for Send < T > { }
47
+
48
+ impl < T > Future for Send < T > {
47
49
type Output = ( ) ;
48
50
49
51
fn poll ( mut self : Pin < & mut Self > , _cx : & mut Context < ' _ > ) -> Poll < ( ) > {
Original file line number Diff line number Diff line change @@ -158,6 +158,20 @@ async fn stream_in_stream() {
158
158
assert_eq ! ( 3 , values. len( ) ) ;
159
159
}
160
160
161
+ #[ tokio:: test]
162
+ async fn yield_non_unpin_value ( ) {
163
+ let s: Vec < _ > = stream ! {
164
+ for i in 0 ..3 {
165
+ yield async move { i } ;
166
+ }
167
+ }
168
+ . buffered ( 1 )
169
+ . collect ( )
170
+ . await ;
171
+
172
+ assert_eq ! ( s, vec![ 0 , 1 , 2 ] ) ;
173
+ }
174
+
161
175
#[ test]
162
176
fn test ( ) {
163
177
let t = trybuild:: TestCases :: new ( ) ;
You can’t perform that action at this time.
0 commit comments