embrio-rs icon indicating copy to clipboard operation
embrio-rs copied to clipboard

#[embrio_async] can't handle expressions in macros

Open jrobsonchase opened this issue 5 years ago • 1 comments

Not sure if this is something that's fixable or not. If something.await is in the arguments to a macro expression, it can't be expanded since syn represents the arguments to a macro invocation as an un-parsed TokenStream.

For example, write!(output, "{}", something.read().await) would result in a "await used outside of an async block" compile error since our macro wouldn't see the something.read().await as an expression or be able to traverse it.

I think the only way to solve this reliably would be to somehow ensure that we're the last macro to be expanded, which doesn't seem to be a thing, but there's a pre-rfc that sounds like what we'd need.

jrobsonchase avatar May 17 '19 19:05 jrobsonchase