Open
Description
This little program gives a "reached the recursion limit during monomorphization" error.
fn main() {
go(range(0, 5u));
}
fn go<T>(it: T) where T: Iterator<uint> {
let mut p = it;
match p.next() {
Some(_) => {
go(p.by_ref());
}
None => {}
}
}
The recursion limit is reached due to wrapping the iterator into ByRefs for every recursion step. IRC suggested that this could be a bug as this should be caught before monomorphization.