@@ -207,7 +207,7 @@ pub fn async_stream_block(input: TokenStream) -> TokenStream {
207207 tokens. into ( )
208208}
209209
210- /// The scope in which `#[for_await]`, `await!` and `await_item!` was called.
210+ /// The scope in which `#[for_await]`, `await!` was called.
211211///
212212/// The type of generator depends on which scope is called.
213213#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
@@ -218,7 +218,7 @@ enum Scope {
218218 Stream ,
219219 /// `static move ||`, `||`
220220 ///
221- /// It cannot call `#[for_await]`, `await!` and `await_item!` in this scope.
221+ /// It cannot call `#[for_await]`, `await!` in this scope.
222222 Closure ,
223223}
224224
@@ -297,13 +297,7 @@ impl Expand {
297297 /// Expands a macro.
298298 fn expand_macro ( & mut self , mut expr : ExprMacro ) -> Expr {
299299 if self . 0 == Stream && expr. mac . path . is_ident ( "await" ) {
300- return self . expand_await_macros ( expr, "poll_with_tls_context" ) ;
301- } else if expr. mac . path . is_ident ( "await_item" ) {
302- match self . 0 {
303- Stream => return self . expand_await_macros ( expr, "poll_next_with_tls_context" ) ,
304- Closure => return outside_of_async_error ! ( expr, "await_item!" ) ,
305- Future => { }
306- }
300+ return self . expand_await_macros ( expr) ;
307301 } else if expr. mac . path . is_ident ( "async_stream_block" ) {
308302 // FIXME: When added Parse impl for ExprCall, replace `if let ..` + `unreachable!()`
309303 // with `let` + `.unwrap()`
@@ -322,16 +316,15 @@ impl Expand {
322316 Expr :: Macro ( expr)
323317 }
324318
325- /// Expands `await!(expr)` or `await_item!(expr)` in `async_stream` scope.
319+ /// Expands `await!(expr)` in `async_stream` scope.
326320 ///
327321 /// It needs to adjust the type yielded by the macro because generators used internally by
328322 /// async fn yield `()` type, but generators used internally by `async_stream` yield
329323 /// `Poll<U>` type.
330- fn expand_await_macros ( & mut self , expr : ExprMacro , poll_fn : & str ) -> Expr {
324+ fn expand_await_macros ( & mut self , expr : ExprMacro ) -> Expr {
331325 assert_eq ! ( self . 0 , Stream ) ;
332326
333327 let expr = expr. mac . tts ;
334- let poll_fn = Ident :: new ( poll_fn, Span :: call_site ( ) ) ;
335328
336329 // Because macro input (`#expr`) is untrusted, use `syn::parse2` + `expr_compile_error`
337330 // instead of `syn::parse_quote!` to generate better error messages (`syn::parse_quote!`
@@ -340,7 +333,7 @@ impl Expand {
340333 let mut __pinned = #expr;
341334 loop {
342335 if let :: futures:: core_reexport:: task:: Poll :: Ready ( x) =
343- :: futures:: async_stream:: #poll_fn ( unsafe {
336+ :: futures:: async_stream:: poll_with_tls_context ( unsafe {
344337 :: futures:: core_reexport:: pin:: Pin :: new_unchecked( & mut __pinned)
345338 } )
346339 {
0 commit comments