From 014a453de8f22957e989d5f39d39b8fb2b6cc442 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Fri, 8 Nov 2019 00:02:58 +0100 Subject: [PATCH 1/7] (cargo-release) version 1.1.1 Signed-off-by: Yoshua Wuyts --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9441b21..ec18269 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "async-attributes" description = "Experimental language-level polyfills for Async Rust." -version = "1.1.0" +version = "1.1.1" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/async-rs/async-attributes" From cfbfdb125682c7574606d4fe09bb2c324fa20fdf Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Sat, 9 Nov 2019 20:15:10 +1100 Subject: [PATCH 2/7] Fix docs to no longer mention `runtime` but `async_std` --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 755a8d5..92cc9e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,7 +56,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream { if name != "main" { return TokenStream::from(quote_spanned! { name.span() => - compile_error!("only the main function can be tagged with #[runtime::main]"), + compile_error!("only the main function can be tagged with #[async_std::main]"), }); } From ee3b07e3fcec6f7eda854f91d9f9c82ba27e4589 Mon Sep 17 00:00:00 2001 From: Kazuhiko Kikuchi Date: Fri, 31 Jul 2020 09:37:09 +0900 Subject: [PATCH 3/7] fix compile error with rustc 1.45.0 ``` ~/async-attributes$ cargo build Blocking waiting for file lock on build directory Compiling async-attributes v1.1.1 (/home/kazuk/async-attributes) error: unused extern crate --> src/lib.rs:30:1 | 30 | extern crate proc_macro; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: the lint level is defined here --> src/lib.rs:26:45 | 26 | #![forbid(unsafe_code, future_incompatible, rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[forbid(unused_extern_crates)]` implied by `#[forbid(rust_2018_idioms)]` error: aborting due to previous error error: could not compile `async-attributes`. ``` --- src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 92cc9e4..ba47d25 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,8 +27,6 @@ #![deny(missing_debug_implementations, nonstandard_style)] #![recursion_limit = "512"] -extern crate proc_macro; - use proc_macro::TokenStream; use quote::{quote, quote_spanned}; use syn::spanned::Spanned; From b2c4f4b1e8d1fb70cabfe96089305a2d88097631 Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Wed, 5 Aug 2020 08:47:07 +0100 Subject: [PATCH 4/7] fix: include visibility modifiers in macro output - fixes https://github.com/async-rs/async-attributes/issues/17 --- src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ba47d25..e48e4a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,6 +51,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream { let name = &input.sig.ident; let body = &input.block; let attrs = &input.attrs; + let vis = &input.vis; if name != "main" { return TokenStream::from(quote_spanned! { name.span() => @@ -65,7 +66,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream { } let result = quote! { - fn main() #ret { + #vis fn main() #ret { #(#attrs)* async fn main(#inputs) #ret { #body @@ -100,6 +101,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream { let name = &input.sig.ident; let body = &input.block; let attrs = &input.attrs; + let vis = &input.vis; if input.sig.asyncness.is_none() { return TokenStream::from(quote_spanned! { input.span() => @@ -110,7 +112,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream { let result = quote! { #[test] #(#attrs)* - fn #name() #ret { + #vis fn #name() #ret { async_std::task::block_on(async { #body }) } }; @@ -142,6 +144,7 @@ pub fn bench(_attr: TokenStream, item: TokenStream) -> TokenStream { let name = &input.sig.ident; let body = &input.block; let attrs = &input.attrs; + let vis = &input.vis; if input.sig.asyncness.is_none() { return TokenStream::from(quote_spanned! { input.span() => @@ -158,7 +161,7 @@ pub fn bench(_attr: TokenStream, item: TokenStream) -> TokenStream { let result = quote! { #[bench] #(#attrs)* - fn #name(b: &mut test::Bencher) #ret { + #vis fn #name(b: &mut test::Bencher) #ret { task::block_on(task::spawn(async { #body })) From 2b011332cb417390064d1477b700a953df1fa267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 25 Nov 2020 09:40:53 +0100 Subject: [PATCH 5/7] Fix possible name collision in attribute output If another `test` or `bench` proc macro is in scope, the `#[test]` in the output may not refer to Rust's own `#[test]` macro, but some other macro. --- src/lib.rs | 4 ++-- tests/test.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e48e4a8..e53c27b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream { } let result = quote! { - #[test] + #[::core::prelude::v1::test] #(#attrs)* #vis fn #name() #ret { async_std::task::block_on(async { #body }) @@ -159,7 +159,7 @@ pub fn bench(_attr: TokenStream, item: TokenStream) -> TokenStream { } let result = quote! { - #[bench] + #[::core::prelude::v1::bench] #(#attrs)* #vis fn #name(b: &mut test::Bencher) #ret { task::block_on(task::spawn(async { diff --git a/tests/test.rs b/tests/test.rs index bc0ca1b..5459acc 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,5 +1,13 @@ +use async_attributes::test; + #[async_attributes::test] async fn test() -> std::io::Result<()> { assert_eq!(2 * 2, 4); Ok(()) } + +#[test] +async fn aliased_test() -> std::io::Result<()> { + assert!(true); + Ok(()) +} From 5fa64e0aa99e26f69b0a814ab484bfd857ceb645 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Sat, 23 Jan 2021 16:45:40 +0100 Subject: [PATCH 6/7] v1.1.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ec18269..5c12dfa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "async-attributes" description = "Experimental language-level polyfills for Async Rust." -version = "1.1.1" +version = "1.1.2" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/async-rs/async-attributes" From d07920ff9c438a756ec7e75a5f4bd73dfce5563a Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Mon, 31 May 2021 09:53:24 -0700 Subject: [PATCH 7/7] dev-deps: async-std @ 1.x --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5c12dfa..cab7a7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,4 +20,4 @@ syn = { version = "1.0", features = ["full"] } quote = "1.0" [dev-dependencies] -async-std = "0.99.5" +async-std = "1.9.0"