summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-67552.rs
blob: 7336b873dd643b7d1eb79ca2a9c3eff3192a2010 (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
33
// build-fail
// compile-flags: -Copt-level=0
// normalize-stderr-test: ".nll/" -> "/"
// ignore-compare-mode-next-solver (hangs)

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
    }
}