From 8718561bf84badd90f77970473a95a37601a0cd0 Mon Sep 17 00:00:00 2001 From: Jeb Rosen Date: Sun, 22 Sep 2019 15:36:17 -0700 Subject: [PATCH] Emit an error when #[async_test] is applied to a function with parameters. --- core/codegen/src/attribute/async_test.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/codegen/src/attribute/async_test.rs b/core/codegen/src/attribute/async_test.rs index 8935c94e..2a8caa1c 100644 --- a/core/codegen/src/attribute/async_test.rs +++ b/core/codegen/src/attribute/async_test.rs @@ -11,7 +11,9 @@ fn parse_input(input: TokenStream) -> Result { return Err(Span::call_site().error("`#[async_test]` can only be applied to async functions")) } - // TODO.async: verify of the form `async fn name(/* no args */) -> R` + if !function.sig.inputs.is_empty() { + return Err(Span::call_site().error("`#[async_test]` can only be applied to functions with no parameters")); + } Ok(function) }