From f0f9309e40b95ae7c2f4994662b30c1d49d72e4a Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 6 Jan 2023 14:39:28 -0800 Subject: [PATCH] Move function argument cfg tests to issue-specific regression test --- tests/test.rs | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/test.rs b/tests/test.rs index 7b9078d..19e9165 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -54,10 +54,6 @@ trait Trait { async fn calls_mut(&mut self) { self.selfmut().await; } - - async fn cfg_param(&self, param: u8); - async fn cfg_param_wildcard(&self, _: u8); - async fn cfg_param_tuple(&self, (left, right): (u8, u8)); } struct Struct; @@ -91,17 +87,6 @@ impl Trait for Struct { async fn calls_mut(&mut self) { self.selfmut().await; } - - async fn cfg_param(&self, #[cfg(any())] param: u8, #[cfg(all())] _unused: u8) {} - - async fn cfg_param_wildcard(&self, #[cfg(any())] _: u8, #[cfg(all())] _: u8) {} - - async fn cfg_param_tuple( - &self, - #[cfg(any())] (left, right): (u8, u8), - #[cfg(all())] (_left, _right): (u8, u8), - ) { - } } pub async fn test() { @@ -1479,3 +1464,31 @@ pub mod issue210 { async fn f(self: Arc) {} } } + +// https://github.com/dtolnay/async-trait/issues/226 +pub mod issue226 { + use async_trait::async_trait; + + #[async_trait] + pub trait Trait { + async fn cfg_param(&self, param: u8); + async fn cfg_param_wildcard(&self, _: u8); + async fn cfg_param_tuple(&self, (left, right): (u8, u8)); + } + + struct Struct; + + #[async_trait] + impl Trait for Struct { + async fn cfg_param(&self, #[cfg(any())] param: u8, #[cfg(all())] _unused: u8) {} + + async fn cfg_param_wildcard(&self, #[cfg(any())] _: u8, #[cfg(all())] _: u8) {} + + async fn cfg_param_tuple( + &self, + #[cfg(any())] (left, right): (u8, u8), + #[cfg(all())] (_left, _right): (u8, u8), + ) { + } + } +}