Skip to content

Commit 9c6cd9c

Browse files
committed
Add regression test for issue 2
1 parent fd019f2 commit 9c6cd9c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
use async_trait::async_trait;
44

5+
// Renaming to avoid masking missing absolute paths in generated code.
6+
use std::future::Future as StdFuture;
7+
58
#[async_trait]
69
trait Trait {
710
type Assoc;
@@ -115,3 +118,16 @@ pub async fn test_object_safe_with_default() {
115118
let object = &Struct as &dyn ObjectSafe;
116119
object.f().await;
117120
}
121+
122+
// https://github.com/dtolnay/async-trait/issues/2
123+
#[async_trait]
124+
pub trait Issue2: StdFuture {
125+
async fn flatten(self) -> <<Self as StdFuture>::Output as StdFuture>::Output
126+
where
127+
Self::Output: StdFuture + Send,
128+
Self: Sized,
129+
{
130+
let nested_future = self.await;
131+
nested_future.await
132+
}
133+
}

0 commit comments

Comments
 (0)