Skip to content

Commit

Permalink
Move function argument cfg tests to issue-specific regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 6, 2023
1 parent 2866cb9 commit f0f9309
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -1479,3 +1464,31 @@ pub mod issue210 {
async fn f(self: Arc<Self>) {}
}
}

// 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),
) {
}
}
}

0 comments on commit f0f9309

Please sign in to comment.