Skip to content

Commit

Permalink
Add regression test for issue 161
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 17, 2021
1 parent fa92d1f commit 62f9924
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ quote = "1.0"
syn = { version = "1.0.61", features = ["full", "visit-mut"] }

[dev-dependencies]
futures = "0.3"
rustversion = "1.0"
tracing = "0.1.14"
tracing-attributes = "0.1.14"
Expand Down
25 changes: 25 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,3 +1335,28 @@ pub mod issue158 {
}
}
}

// https://github.com/dtolnay/async-trait/issues/161
pub mod issue161 {
use async_trait::async_trait;
use futures::future::FutureExt;
use std::sync::Arc;

#[async_trait]
pub trait Trait {
async fn f(self: Arc<Self>);
}

pub struct MyStruct(bool);

#[async_trait]
impl Trait for MyStruct {
async fn f(self: Arc<Self>) {
futures::select! {
_ = async {
println!("{}", self.0);
}.fuse() => {}
}
}
}
}

0 comments on commit 62f9924

Please sign in to comment.