Guest User

Untitled

a guest
Jun 24th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. fn foo() -> Result<Vec<i32>, i32> { let vec = (0..32).map(|n| if n % 17 != 0 { Ok(n) } else { Err(n) }).collect()?; vec }
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0284]: type annotations required: cannot resolve `<_ as std::ops::Try>::Ok == _`
  11. --> src/main.rs:5:55
  12. |
  13. 5 | fn foo() -> Result<Vec<i32>, i32> { let vec = (0..32).map(|n| if n % 17 != 0 { Ok(n) } else { Err(n) }).collect()?; vec }
  14. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  15.  
  16. error: aborting due to previous error
  17.  
  18. For more information about this error, try `rustc --explain E0284`.
  19. error: Could not compile `playground`.
  20.  
  21. To learn more, run the command again with --verbose.
  22.  
  23. */
  24.  
  25. /* ~~~~=== stdout ===~~~~
  26.  
  27. */
Add Comment
Please, Sign In to add comment