Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[embrio_async] can't handle expressions in macros #14

Open
jrobsonchase opened this issue May 17, 2019 · 1 comment
Open

#[embrio_async] can't handle expressions in macros #14

jrobsonchase opened this issue May 17, 2019 · 1 comment

Comments

@jrobsonchase
Copy link
Collaborator

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.

@Nemo157
Copy link
Owner

Nemo157 commented May 18, 2019

There's also been discussion of having an API for a proc-macro to ask rustc to expand inner macros. I can't think of a way to work around this in general without support from the compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants