File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -108,9 +108,9 @@ where
108108
109109#[ unstable( feature = "gen_future" , issue = "50547" ) ]
110110/// 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 >
112112where
113113 F : Future
114114{
115- get_task_cx ( |cx| f. reborrow ( ) . poll ( cx) )
115+ get_task_cx ( |cx| f. poll ( cx) )
116116}
Original file line number Diff line number Diff line change @@ -227,14 +227,17 @@ macro_rules! eprintln {
227227macro_rules! await {
228228 ( $e: expr) => { {
229229 let mut pinned = $e;
230- let mut pinned = unsafe { $crate:: mem:: PinMut :: new_unchecked( & mut pinned) } ;
231230 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;
237237 }
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
238241 }
239242 } }
240243}
You can’t perform that action at this time.
0 commit comments