2022-12-06 17:34:24 +00:00
|
|
|
error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
|
|
|
|
--> $DIR/invalid-iterator-chain.rs:7:20
|
|
|
|
|
|
|
|
|
LL | println!("{}", scores.sum::<i32>());
|
|
|
|
| ^^^^^^ --- required by a bound introduced by this call
|
|
|
|
| |
|
|
|
|
| the trait `Sum<()>` is not implemented for `i32`
|
|
|
|
|
|
|
|
|
= help: the following other types implement trait `Sum<A>`:
|
|
|
|
<i32 as Sum<&'a i32>>
|
|
|
|
<i32 as Sum>
|
2022-12-06 20:08:17 +00:00
|
|
|
note: the method call chain might not have had the expected associated types
|
|
|
|
--> $DIR/invalid-iterator-chain.rs:3:10
|
2022-12-06 17:34:24 +00:00
|
|
|
|
|
|
|
|
LL | let scores = vec![(0, 0)]
|
|
|
|
| ------------ this expression has type `Vec<({integer}, {integer})>`
|
|
|
|
LL | .iter()
|
2022-12-06 20:08:17 +00:00
|
|
|
| ^^^^^^ associated type `std::iter::Iterator::Item` is `&({integer}, {integer})` here
|
2022-12-06 17:34:24 +00:00
|
|
|
LL | .map(|(a, b)| {
|
2022-12-06 20:08:17 +00:00
|
|
|
| __________^
|
2022-12-06 17:34:24 +00:00
|
|
|
LL | | a + b;
|
|
|
|
LL | | });
|
2022-12-06 20:08:17 +00:00
|
|
|
| |__________^ associated type `std::iter::Iterator::Item` changed to `()` here
|
2022-12-06 17:34:24 +00:00
|
|
|
note: required by a bound in `std::iter::Iterator::sum`
|
|
|
|
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
|
|
|
|
|
|
|
|
LL | S: Sum<Self::Item>,
|
|
|
|
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
|
|
|
|
|
|
|
|
error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
|
|
|
|
--> $DIR/invalid-iterator-chain.rs:10:9
|
|
|
|
|
|
|
|
|
LL | / vec![0, 1]
|
|
|
|
LL | | .iter()
|
2022-12-06 18:32:49 +00:00
|
|
|
LL | | .map(|x| x * 2)
|
|
|
|
LL | | .map(|x| x as f64)
|
|
|
|
... |
|
|
|
|
LL | | .map(|x| { x + 1 })
|
2022-12-06 17:34:24 +00:00
|
|
|
LL | | .map(|x| { x; })
|
|
|
|
| |____________________________^ the trait `Sum<()>` is not implemented for `i32`
|
|
|
|
LL | .sum::<i32>(),
|
|
|
|
| --- required by a bound introduced by this call
|
|
|
|
|
|
|
|
|
= help: the following other types implement trait `Sum<A>`:
|
|
|
|
<i32 as Sum<&'a i32>>
|
|
|
|
<i32 as Sum>
|
2022-12-06 20:08:17 +00:00
|
|
|
note: the method call chain might not have had the expected associated types
|
|
|
|
--> $DIR/invalid-iterator-chain.rs:11:14
|
2022-12-06 17:34:24 +00:00
|
|
|
|
|
|
|
|
LL | vec![0, 1]
|
|
|
|
| ---------- this expression has type `Vec<{integer}>`
|
|
|
|
LL | .iter()
|
2022-12-06 20:08:17 +00:00
|
|
|
| ^^^^^^ associated type `std::iter::Iterator::Item` is `&{integer}` here
|
2022-12-06 18:32:49 +00:00
|
|
|
LL | .map(|x| x * 2)
|
2022-12-06 20:08:17 +00:00
|
|
|
| ^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `{integer}` here
|
2022-12-06 18:32:49 +00:00
|
|
|
LL | .map(|x| x as f64)
|
2022-12-06 20:08:17 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `f64` here
|
2022-12-06 18:32:49 +00:00
|
|
|
LL | .map(|x| x as i64)
|
2022-12-06 20:08:17 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `i64` here
|
2022-12-06 18:32:49 +00:00
|
|
|
LL | .filter(|x| *x > 0)
|
2022-12-06 20:08:17 +00:00
|
|
|
| ------------------
|
2022-12-06 18:32:49 +00:00
|
|
|
LL | .map(|x| { x + 1 })
|
2022-12-06 20:08:17 +00:00
|
|
|
| ------------------
|
2022-12-06 17:34:24 +00:00
|
|
|
LL | .map(|x| { x; })
|
2022-12-06 20:08:17 +00:00
|
|
|
| ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
|
2022-12-06 17:34:24 +00:00
|
|
|
note: required by a bound in `std::iter::Iterator::sum`
|
|
|
|
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
|
|
|
|
|
|
|
|
LL | S: Sum<Self::Item>,
|
|
|
|
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
|
|
|
|
|
|
|
|
error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
|
2022-12-06 18:32:49 +00:00
|
|
|
--> $DIR/invalid-iterator-chain.rs:20:20
|
2022-12-06 17:34:24 +00:00
|
|
|
|
|
|
|
|
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
|
|
|
|
| |
|
|
|
|
| the trait `Sum<()>` is not implemented for `i32`
|
|
|
|
|
|
|
|
|
= help: the following other types implement trait `Sum<A>`:
|
|
|
|
<i32 as Sum<&'a i32>>
|
|
|
|
<i32 as Sum>
|
2022-12-06 20:08:17 +00:00
|
|
|
note: the method call chain might not have had the expected associated types
|
|
|
|
--> $DIR/invalid-iterator-chain.rs:20:31
|
2022-12-06 17:34:24 +00:00
|
|
|
|
|
|
|
|
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
2022-12-06 20:08:17 +00:00
|
|
|
| ---------- ^^^^^^ ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` changed to `()` here
|
2022-12-06 17:34:24 +00:00
|
|
|
| | |
|
|
|
|
| | associated type `std::iter::Iterator::Item` is `&{integer}` here
|
|
|
|
| this expression has type `Vec<{integer}>`
|
|
|
|
note: required by a bound in `std::iter::Iterator::sum`
|
|
|
|
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
|
|
|
|
|
|
|
|
LL | S: Sum<Self::Item>,
|
|
|
|
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
|
|
|
|
|
|
|
|
error[E0277]: the trait bound `i32: Sum<&()>` is not satisfied
|
2022-12-06 18:32:49 +00:00
|
|
|
--> $DIR/invalid-iterator-chain.rs:21:20
|
2022-12-06 17:34:24 +00:00
|
|
|
|
|
|
|
|
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
|
|
|
|
| |
|
|
|
|
| the trait `Sum<&()>` is not implemented for `i32`
|
|
|
|
|
|
|
|
|
= help: the following other types implement trait `Sum<A>`:
|
|
|
|
<i32 as Sum<&'a i32>>
|
|
|
|
<i32 as Sum>
|
2022-12-06 20:08:17 +00:00
|
|
|
note: the method call chain might not have had the expected associated types
|
2022-12-06 18:32:49 +00:00
|
|
|
--> $DIR/invalid-iterator-chain.rs:21:33
|
2022-12-06 17:34:24 +00:00
|
|
|
|
|
|
|
|
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
|
|
|
|
| ------------ ^^^^^^ associated type `std::iter::Iterator::Item` is `&()` here
|
|
|
|
| |
|
|
|
|
| this expression has type `Vec<()>`
|
|
|
|
note: required by a bound in `std::iter::Iterator::sum`
|
|
|
|
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
|
|
|
|
|
|
|
|
LL | S: Sum<Self::Item>,
|
|
|
|
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|