Skip to content

Update syn and quote to 1.0 #3

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

Merged
merged 1 commit into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ default = ["native"]
native = []

[dependencies]
syn = { version = "0.15.33", features = ["full"] }
proc-macro2 = { version = "0.4.29", features = ["nightly"] }
quote = "0.6.12"
async-trait = "0.1.11"
syn = { version = "1.0", features = ["full"] }
quote = "1.0"

[dev-dependencies]
async-std = "0.99.5"
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ use syn::spanned::Spanned;
pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(item as syn::ItemFn);

let ret = &input.decl.output;
let inputs = &input.decl.inputs;
let name = &input.ident;
let ret = &input.sig.output;
let inputs = &input.sig.inputs;
let name = &input.sig.ident;
let body = &input.block;
let attrs = &input.attrs;

Expand All @@ -77,7 +77,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
});
}

if input.asyncness.is_none() {
if input.sig.asyncness.is_none() {
return TokenStream::from(quote_spanned! { input.span() =>
compile_error!("the async keyword is missing from the function declaration"),
});
Expand All @@ -86,7 +86,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
let result = quote! {
fn main() #ret {
#(#attrs)*
async fn main(#(#inputs),*) #ret {
async fn main(#inputs) #ret {
#body
}

Expand Down Expand Up @@ -115,12 +115,12 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(item as syn::ItemFn);

let ret = &input.decl.output;
let name = &input.ident;
let ret = &input.sig.output;
let name = &input.sig.ident;
let body = &input.block;
let attrs = &input.attrs;

if input.asyncness.is_none() {
if input.sig.asyncness.is_none() {
return TokenStream::from(quote_spanned! { input.span() =>
compile_error!("the async keyword is missing from the function declaration"),
});
Expand Down Expand Up @@ -159,12 +159,12 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream {
pub fn bench(_attr: TokenStream, item: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(item as syn::ItemFn);

let args = &input.decl.inputs;
let name = &input.ident;
let args = &input.sig.inputs;
let name = &input.sig.ident;
let body = &input.block;
let attrs = &input.attrs;

if input.asyncness.is_none() {
if input.sig.asyncness.is_none() {
return TokenStream::from(quote_spanned! { input.span() =>
compile_error!("the async keyword is missing from the function declaration"),
});
Expand Down