We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
None
The following code (repository: https://github.com/Aaron1011/async-syn):
// src/lib.rs use syn::ItemFn; use proc_macro::TokenStream; #[proc_macro_attribute] pub fn parse_fn(_attr: TokenStream, item: TokenStream) -> TokenStream { syn::parse_macro_input!(item as ItemFn); TokenStream::new() } // src/main.rs macro_rules! make_fn { ($input:item) => { #[async_syn::parse_fn] fn outer() { $input } } } make_fn!(async fn inner() {}); fn main() { println!("Hello, world!"); }
gives the following error:
error: unexpected token --> src/main.rs:10:16 | 10 | make_fn!(async fn inner() {}); | ^^
I think this is caused by the way syn does lookahead when parsing async fn. The error goes away if you change async fn inner() {} to fn inner() {}
syn
async fn
async fn inner() {}
fn inner() {}
Minimized from rust-lang/rust#78629
The text was updated successfully, but these errors were encountered:
@dtolnay Thanks for the fast fix!
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The following code (repository: https://github.com/Aaron1011/async-syn):
gives the following error:
I think this is caused by the way
syn
does lookahead when parsingasync fn
. The error goes away if you changeasync fn inner() {}
tofn inner() {}
Minimized from rust-lang/rust#78629
The text was updated successfully, but these errors were encountered: