futures-async-stream icon indicating copy to clipboard operation
futures-async-stream copied to clipboard

Procedural macros provided by futures-async-stream cannot handle expressions in macros

Open taiki-e opened this issue 6 years ago • 1 comments

Currently, procedural macros provided by futures-async-stream cannot handle expressions in macros.

https://github.com/rust-lang-nursery/futures-rs/pull/1548#discussion_r285341883:

It is not possible to replace .await in macros such as assert!(foo.await) with this.

Full support for this can not be done without compiler support, but it can support for some kinds of macros (however, this is not necessarily preferable, as a macro may call an async block etc): https://github.com/taiki-e/futures-rs/commit/fb33504229db314fb97759c3170ee3ad73785c08

Related: https://github.com/Nemo157/embrio-rs/issues/14

Refs: https://github.com/taiki-e/futures-async-stream/commit/5198fe4eced00a23b7a0235bc1333d4535fe3501

taiki-e avatar Aug 02 '19 11:08 taiki-e

Also looks like yield in a macro is not possible. I was trying to use a local macro to limit code duplication inside a function.

douglas-raillard-arm avatar Nov 22 '22 10:11 douglas-raillard-arm