Files
rust/tests/ui/codegen/normalization-overflow/recursion-issue-117696-1.rs
2025-10-12 06:59:10 +08:00

31 lines
460 B
Rust

//@ build-fail
fn main() {
let mut it = (Empty);
rec(&mut it);
}
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);
//~^ ERROR: reached the recursion limit while instantiating
} else {
rec(identity(&mut it))
}
}