30 lines
400 B
Rust
30 lines
400 B
Rust
|
//@ known-bug: #117696
|
||
|
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);
|
||
|
} else {
|
||
|
rec(identity(&mut it))
|
||
|
}
|
||
|
}
|