File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -108,9 +108,9 @@ where
108
108
109
109
#[ unstable( feature = "gen_future" , issue = "50547" ) ]
110
110
/// Polls a future in the current thread-local task context.
111
- pub fn poll_in_task_cx < F > ( f : & mut PinMut < F > ) -> Poll < F :: Output >
111
+ pub fn poll_in_task_cx < F > ( f : PinMut < F > ) -> Poll < F :: Output >
112
112
where
113
113
F : Future
114
114
{
115
- get_task_cx ( |cx| f. reborrow ( ) . poll ( cx) )
115
+ get_task_cx ( |cx| f. poll ( cx) )
116
116
}
Original file line number Diff line number Diff line change @@ -227,14 +227,17 @@ macro_rules! eprintln {
227
227
macro_rules! await {
228
228
( $e: expr) => { {
229
229
let mut pinned = $e;
230
- let mut pinned = unsafe { $crate:: mem:: PinMut :: new_unchecked( & mut pinned) } ;
231
230
loop {
232
- match $crate:: future:: poll_in_task_cx( & mut pinned) {
233
- // FIXME(cramertj) prior to stabilizing await, we have to ensure that this
234
- // can't be used to create a generator on stable via `|| await!()`.
235
- $crate:: task:: Poll :: Pending => yield,
236
- $crate:: task:: Poll :: Ready ( x) => break x,
231
+ if let $crate:: task:: Poll :: Ready ( x) =
232
+ $crate:: future:: poll_in_task_cx( unsafe {
233
+ $crate:: mem:: PinMut :: new_unchecked( & mut pinned)
234
+ } )
235
+ {
236
+ break x;
237
237
}
238
+ // FIXME(cramertj) prior to stabilizing await, we have to ensure that this
239
+ // can't be used to create a generator on stable via `|| await!()`.
240
+ yield
238
241
}
239
242
} }
240
243
}
You can’t perform that action at this time.
0 commit comments