Skip to content

Commit 56fcf2c

Browse files
authored
Merge pull request #3 from taiki-e/proc-macro-next
Update syn and quote to 1.0
2 parents 13185d9 + 199a488 commit 56fcf2c

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ default = ["native"]
2020
native = []
2121

2222
[dependencies]
23-
syn = { version = "0.15.33", features = ["full"] }
24-
proc-macro2 = { version = "0.4.29", features = ["nightly"] }
25-
quote = "0.6.12"
26-
async-trait = "0.1.11"
23+
syn = { version = "1.0", features = ["full"] }
24+
quote = "1.0"
2725

2826
[dev-dependencies]
2927
async-std = "0.99.5"

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ use syn::spanned::Spanned;
6565
pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
6666
let input = syn::parse_macro_input!(item as syn::ItemFn);
6767

68-
let ret = &input.decl.output;
69-
let inputs = &input.decl.inputs;
70-
let name = &input.ident;
68+
let ret = &input.sig.output;
69+
let inputs = &input.sig.inputs;
70+
let name = &input.sig.ident;
7171
let body = &input.block;
7272
let attrs = &input.attrs;
7373

@@ -77,7 +77,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
7777
});
7878
}
7979

80-
if input.asyncness.is_none() {
80+
if input.sig.asyncness.is_none() {
8181
return TokenStream::from(quote_spanned! { input.span() =>
8282
compile_error!("the async keyword is missing from the function declaration"),
8383
});
@@ -86,7 +86,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
8686
let result = quote! {
8787
fn main() #ret {
8888
#(#attrs)*
89-
async fn main(#(#inputs),*) #ret {
89+
async fn main(#inputs) #ret {
9090
#body
9191
}
9292

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

118-
let ret = &input.decl.output;
119-
let name = &input.ident;
118+
let ret = &input.sig.output;
119+
let name = &input.sig.ident;
120120
let body = &input.block;
121121
let attrs = &input.attrs;
122122

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

162-
let args = &input.decl.inputs;
163-
let name = &input.ident;
162+
let args = &input.sig.inputs;
163+
let name = &input.sig.ident;
164164
let body = &input.block;
165165
let attrs = &input.attrs;
166166

167-
if input.asyncness.is_none() {
167+
if input.sig.asyncness.is_none() {
168168
return TokenStream::from(quote_spanned! { input.span() =>
169169
compile_error!("the async keyword is missing from the function declaration"),
170170
});

0 commit comments

Comments
 (0)