diff options
author | Douman <douman@gmx.se> | 2019-08-09 17:04:41 +0200 |
---|---|---|
committer | Lucio Franco <luciofranco14@gmail.com> | 2019-08-09 11:04:41 -0400 |
commit | 18833a8e6709c3489ea8f401f1a9d9a28ae20226 (patch) | |
tree | a4bd2e9a8ab8716d3db71bf95062f9085ad0939c /tokio-macros | |
parent | eba8bf2b4b082d7a9daab8fd3aecf7a95e9466e2 (diff) |
macros: Error on function with arguments (#1419)
Diffstat (limited to 'tokio-macros')
-rw-r--r-- | tokio-macros/src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index b7279b1e..ccb6ae7d 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -62,6 +62,12 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { }; return TokenStream::from(tokens); + } else if !input.decl.inputs.is_empty() { + let tokens = quote_spanned! { input.span() => + compile_error!("the main function cannot accept arguments"); + }; + + return TokenStream::from(tokens); } let mut runtime = RuntimeType::Multi; @@ -102,7 +108,7 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { /// /// # Examples /// -/// ```ignore +/// ```no_run /// #![feature(async_await)] /// /// #[tokio::test] @@ -135,6 +141,12 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream { }; return TokenStream::from(tokens); + } else if !input.decl.inputs.is_empty() { + let tokens = quote_spanned! { input.span() => + compile_error!("the test function cannot accept arguments"); + }; + + return TokenStream::from(tokens); } let result = quote! { |