@@ -207,7 +207,7 @@ pub fn async_stream_block(input: TokenStream) -> TokenStream {
207
207
tokens. into ( )
208
208
}
209
209
210
- /// The scope in which `#[for_await]`, `await!` and `await_item!` was called.
210
+ /// The scope in which `#[for_await]`, `await!` was called.
211
211
///
212
212
/// The type of generator depends on which scope is called.
213
213
#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
@@ -218,7 +218,7 @@ enum Scope {
218
218
Stream ,
219
219
/// `static move ||`, `||`
220
220
///
221
- /// It cannot call `#[for_await]`, `await!` and `await_item!` in this scope.
221
+ /// It cannot call `#[for_await]`, `await!` in this scope.
222
222
Closure ,
223
223
}
224
224
@@ -297,13 +297,7 @@ impl Expand {
297
297
/// Expands a macro.
298
298
fn expand_macro ( & mut self , mut expr : ExprMacro ) -> Expr {
299
299
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) ;
307
301
} else if expr. mac . path . is_ident ( "async_stream_block" ) {
308
302
// FIXME: When added Parse impl for ExprCall, replace `if let ..` + `unreachable!()`
309
303
// with `let` + `.unwrap()`
@@ -322,16 +316,15 @@ impl Expand {
322
316
Expr :: Macro ( expr)
323
317
}
324
318
325
- /// Expands `await!(expr)` or `await_item!(expr)` in `async_stream` scope.
319
+ /// Expands `await!(expr)` in `async_stream` scope.
326
320
///
327
321
/// It needs to adjust the type yielded by the macro because generators used internally by
328
322
/// async fn yield `()` type, but generators used internally by `async_stream` yield
329
323
/// `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 {
331
325
assert_eq ! ( self . 0 , Stream ) ;
332
326
333
327
let expr = expr. mac . tts ;
334
- let poll_fn = Ident :: new ( poll_fn, Span :: call_site ( ) ) ;
335
328
336
329
// Because macro input (`#expr`) is untrusted, use `syn::parse2` + `expr_compile_error`
337
330
// instead of `syn::parse_quote!` to generate better error messages (`syn::parse_quote!`
@@ -340,7 +333,7 @@ impl Expand {
340
333
let mut __pinned = #expr;
341
334
loop {
342
335
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 {
344
337
:: futures:: core_reexport:: pin:: Pin :: new_unchecked( & mut __pinned)
345
338
} )
346
339
{
0 commit comments