2023-09-13 12:33:40 -05:00
|
|
|
// edition: 2021
|
2023-11-24 09:05:11 -06:00
|
|
|
|
|
|
|
// Test doesn't fail until monomorphization time, unfortunately.
|
2023-09-13 12:33:40 -05:00
|
|
|
// build-fail
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = async {
|
|
|
|
A.first().await.second().await;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait First {
|
|
|
|
type Second: Second;
|
|
|
|
async fn first(self) -> Self::Second;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct A;
|
|
|
|
|
|
|
|
impl First for A {
|
|
|
|
type Second = A;
|
|
|
|
async fn first(self) -> Self::Second {
|
|
|
|
A
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Second {
|
|
|
|
async fn second(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<C> Second for C
|
|
|
|
where
|
|
|
|
C: First,
|
|
|
|
{
|
|
|
|
async fn second(self) {
|
2023-11-24 09:05:11 -06:00
|
|
|
//~^ ERROR recursion in an async fn requires boxing
|
2023-09-13 12:33:40 -05:00
|
|
|
self.first().await.second().await;
|
|
|
|
}
|
|
|
|
}
|