summaryrefslogtreecommitdiffstats
path: root/tokio-macros
diff options
context:
space:
mode:
authorDouman <douman@gmx.se>2019-07-22 18:28:07 +0200
committerCarl Lerche <me@carllerche.com>2019-07-22 09:28:07 -0700
commit59bc364a0e71ace4e819a3e5f5048ce2bc388ed4 (patch)
tree7b07d641885482c319b5cfb39e9ff97dcb507687 /tokio-macros
parente88d10a3cbf8471eddde1082e10a9d35e4376bac (diff)
macros: detect double test attribute (#1336)
Diffstat (limited to 'tokio-macros')
-rw-r--r--tokio-macros/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs
index c036f552..3a7b9ec4 100644
--- a/tokio-macros/src/lib.rs
+++ b/tokio-macros/src/lib.rs
@@ -121,6 +121,16 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream {
let body = &input.block;
let attrs = &input.attrs;
+ for attr in attrs {
+ if attr.path.is_ident("test") {
+ let tokens = quote_spanned! { input.span() =>
+ compile_error!("second test attribute is supplied");
+ };
+
+ return TokenStream::from(tokens);
+ }
+ }
+
if input.asyncness.is_none() {
let tokens = quote_spanned! { input.span() =>
compile_error!("the async keyword is missing from the function declaration");