Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- use std::mem::replace; pub fn fibonacci() -> impl Iterator<Item=u128> { let (mut a, mut b) = (0, 1); std::iter::from_fn(|| replace(&mut a, replace(&mut b, a + b))) }
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0425]: cannot find function `from_fn` in module `std::iter`
- --> src/main.rs:6:121
- |
- 6 | use std::mem::replace; pub fn fibonacci() -> impl Iterator<Item=u128> { let (mut a, mut b) = (0, 1); std::iter::from_fn(|| replace(&mut a, replace(&mut b, a + b))) }
- | ^^^^^^^ not found in `std::iter`
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0425`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement