about summary refs log tree commit diff
path: root/tests/ui/impl-trait/in-trait/refine-cycle.rs
blob: d97f9821347efadfe6c640e42877894098ac987f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//@ check-pass
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)

// Make sure that refinement checking doesn't cause a cycle in `Instance::resolve`
// which calls `compare_impl_item`.

trait Foo {
    fn test() -> impl IntoIterator<Item = ()> + Send;
}

struct A;
impl Foo for A {
    fn test() -> impl IntoIterator<Item = ()> + Send {
        B::test()
    }
}

struct B;
impl Foo for B {
    fn test() -> impl IntoIterator<Item = ()> + Send {
        for () in A::test() {}

        []
    }
}

fn main() {}