rust/src/test/ui/issues/issue-49579.rs

18 lines
310 B
Rust
Raw Normal View History

2018-07-28 12:22:42 -05:00
// compile-pass
// ignore-emscripten no i128 support
2018-07-28 12:22:42 -05:00
#![feature(nll)]
fn fibs(n: u32) -> impl Iterator<Item=u128> {
(0 .. n)
.scan((0, 1), |st, _| {
*st = (st.1, st.0 + st.1);
Some(*st)
})
.map(&|(f, _)| f)
}
fn main() {
println!("{:?}", fibs(10).collect::<Vec<_>>());
}