mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
macros: detect double test attribute (#1336)
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user