Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. use std::mem::replace; pub fn fibonacci() -> impl Iterator<Item=u128> { let mut (a, b) = (0, 1); std::iter::from_fn(|| replace(&mut a, replace(&mut b, a + b))) }
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error: expected identifier, found `(`
  14. --> src/main.rs:6:89
  15. |
  16. 6 | use std::mem::replace; pub fn fibonacci() -> impl Iterator<Item=u128> { let mut (a, b) = (0, 1); std::iter::from_fn(|| replace(&mut a, replace(&mut b, a + b))) }
  17. | ^ expected identifier
  18.  
  19. warning: unused import: `std::mem::replace`
  20. --> src/main.rs:6:13
  21. |
  22. 6 | use std::mem::replace; pub fn fibonacci() -> impl Iterator<Item=u128> { let mut (a, b) = (0, 1); std::iter::from_fn(|| replace(&mut a, replace(&mut b, a + b))) }
  23. | ^^^^^^^^^^^^^^^^^
  24. |
  25. = note: #[warn(unused_imports)] on by default
  26.  
  27. error: aborting due to previous error
  28.  
  29. error: Could not compile `playground`.
  30.  
  31. To learn more, run the command again with --verbose.
  32.  
  33. */
  34.  
  35. /* ~~~~=== stdout ===~~~~
  36.  
  37. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement