Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- println!("{:?}", {
- let s: usize = (&[1, 2, 3]).iter().map(|x| x*2).sum(); s // what i meant to write
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (file:///playground)
- error[E0277]: the trait bound `usize: std::iter::Sum<i32>` is not satisfied
- --> src/main.rs:5:57
- |
- 5 | let s: usize = (&[1, 2, 3]).iter().map(|x| x*2).sum(); s // what i meant to write
- | ^^^ the trait `std::iter::Sum<i32>` is not implemented for `usize`
- |
- = help: the following implementations were found:
- <usize as std::iter::Sum<&'a usize>>
- <usize as std::iter::Sum>
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0277`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment