rust/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs

37 lines
538 B
Rust
Raw Normal View History

// edition: 2021
// build-fail
2023-06-24 05:02:54 -05:00
//~^^ ERROR cycle detected when computing layout of
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) {
self.first().await.second().await;
}
}