summaryrefslogtreecommitdiff
path: root/tests/ui/issues/issue-67552.rs
blob: 26466bf838c40454d0d72679c314f9a27adad402 (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
30
31
32
//@ build-fail
//@ compile-flags: -Copt-level=0
//@ normalize-stderr-test: ".nll/" -> "/"

fn main() {
    rec(Empty);
}

struct Empty;

impl Iterator for Empty {
    type Item = ();
    fn next<'a>(&'a mut self) -> core::option::Option<()> {
        None
    }
}

fn identity<T>(x: T) -> T {
    x
}

fn rec<T>(mut it: T)
where
    T: Iterator,
{
    if () == () {
        T::count(it);
    } else {
        rec(identity(&mut it))
        //~^ ERROR reached the recursion limit while instantiating
    }
}