fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB47 linesraw
1error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
2  --> $DIR/sum.rs:4:31
3   |
4LL |     vec![(), ()].iter().sum::<i32>();
5   |                         ---   ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
6   |                         |
7   |                         required by a bound introduced by this call
8   |
9   = help: the trait `Sum<&()>` is not implemented for `i32`
10   = help: the following other types implement trait `Sum<A>`:
11             <i32 as Sum>
12             <i32 as Sum<&'a i32>>
13note: the method call chain might not have had the expected associated types
14  --> $DIR/sum.rs:4:18
15   |
16LL |     vec![(), ()].iter().sum::<i32>();
17   |     ------------ ^^^^^^ `Iterator::Item` is `&()` here
18   |     |
19   |     this expression has type `Vec<()>`
20note: required by a bound in `std::iter::Iterator::sum`
21  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
22
23error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator
24  --> $DIR/sum.rs:7:35
25   |
26LL |     vec![(), ()].iter().product::<i32>();
27   |                         -------   ^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
28   |                         |
29   |                         required by a bound introduced by this call
30   |
31   = help: the trait `Product<&()>` is not implemented for `i32`
32   = help: the following other types implement trait `Product<A>`:
33             <i32 as Product>
34             <i32 as Product<&'a i32>>
35note: the method call chain might not have had the expected associated types
36  --> $DIR/sum.rs:7:18
37   |
38LL |     vec![(), ()].iter().product::<i32>();
39   |     ------------ ^^^^^^ `Iterator::Item` is `&()` here
40   |     |
41   |     this expression has type `Vec<()>`
42note: required by a bound in `std::iter::Iterator::product`
43  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
44
45error: aborting due to 2 previous errors
46
47For more information about this error, try `rustc --explain E0277`.