Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

Commit 6177e6e

Browse files
authored
Merge pull request #91 from tirr-c/syn-1.0
Update syn, proc-macro2, quote to 1.0
2 parents f8ddd37 + ea0c3f2 commit 6177e6e

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

runtime-attributes/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ 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"
23+
syn = { version = "1.0.1", features = ["full"] }
24+
proc-macro2 = { version = "1.0.0", features = ["nightly"] }
25+
quote = "1.0.0"
2626

2727
[dev-dependencies]
2828
runtime-raw = { path = "../runtime-raw", version = "0.3.0-alpha.4" }

runtime-attributes/src/lib.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
4141
};
4242
let input = syn::parse_macro_input!(item as syn::ItemFn);
4343

44-
let ret = &input.decl.output;
45-
let inputs = &input.decl.inputs;
46-
let name = &input.ident;
44+
let ret = &input.sig.output;
45+
let args = input.sig.inputs.iter();
46+
let name = &input.sig.ident;
4747
let body = &input.block;
4848
let attrs = &input.attrs;
4949

@@ -54,7 +54,7 @@ pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
5454
return TokenStream::from(tokens);
5555
}
5656

57-
if input.asyncness.is_none() {
57+
if input.sig.asyncness.is_none() {
5858
let tokens = quote_spanned! { input.span() =>
5959
compile_error!("the async keyword is missing from the function declaration");
6060
};
@@ -64,15 +64,14 @@ pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
6464
let result = quote! {
6565
fn main() #ret {
6666
#(#attrs)*
67-
async fn main(#(#inputs),*) #ret {
67+
async fn main(#(#args),*) #ret {
6868
#body
6969
}
7070

7171
runtime::raw::enter(#rt, async {
7272
main().await
7373
})
7474
}
75-
7675
};
7776

7877
result.into()
@@ -106,12 +105,12 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
106105
};
107106
let input = syn::parse_macro_input!(item as syn::ItemFn);
108107

109-
let ret = &input.decl.output;
110-
let name = &input.ident;
108+
let ret = &input.sig.output;
109+
let name = &input.sig.ident;
111110
let body = &input.block;
112111
let attrs = &input.attrs;
113112

114-
if input.asyncness.is_none() {
113+
if input.sig.asyncness.is_none() {
115114
let tokens = quote_spanned! { input.span() =>
116115
compile_error!("the async keyword is missing from the function declaration");
117116
};
@@ -159,12 +158,12 @@ pub fn bench(attr: TokenStream, item: TokenStream) -> TokenStream {
159158
};
160159
let input = syn::parse_macro_input!(item as syn::ItemFn);
161160

162-
let args = &input.decl.inputs;
163-
let name = &input.ident;
161+
let args = &input.sig.inputs;
162+
let name = &input.sig.ident;
164163
let body = &input.block;
165164
let attrs = &input.attrs;
166165

167-
if input.asyncness.is_none() {
166+
if input.sig.asyncness.is_none() {
168167
let tokens = quote_spanned! { input.span() =>
169168
compile_error!("the async keyword is missing from the function declaration");
170169
};

0 commit comments

Comments
 (0)