Guest User

Untitled

a guest
Jun 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. (&[1, 2, 3]).iter().map(|x| x*2).sum::<usize>()
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0277]: the trait bound `usize: std::iter::Sum<i32>` is not satisfied
  11. --> src/main.rs:5:42
  12. |
  13. 5 | (&[1, 2, 3]).iter().map(|x| x*2).sum::<usize>()
  14. | ^^^ the trait `std::iter::Sum<i32>` is not implemented for `usize`
  15. |
  16. = help: the following implementations were found:
  17. <usize as std::iter::Sum<&'a usize>>
  18. <usize as std::iter::Sum>
  19.  
  20. error: aborting due to previous error
  21.  
  22. For more information about this error, try `rustc --explain E0277`.
  23. error: Could not compile `playground`.
  24.  
  25. To learn more, run the command again with --verbose.
  26.  
  27. */
  28.  
  29. /* ~~~~=== stdout ===~~~~
  30.  
  31. */
Add Comment
Please, Sign In to add comment