1
- error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
1
+ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
2
2
--> $DIR/invalid-iterator-chain.rs:7:20
3
3
|
4
4
LL | println!("{}", scores.sum::<i32>());
5
5
| ^^^^^^ --- required by a bound introduced by this call
6
6
| |
7
- | the trait `Sum<()>` is not implemented for `i32 `
7
+ | value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()> `
8
8
|
9
+ = help: the trait `Sum<()>` is not implemented for `i32`
9
10
= help: the following other types implement trait `Sum<A>`:
10
11
<i32 as Sum<&'a i32>>
11
12
<i32 as Sum>
@@ -27,7 +28,7 @@ note: required by a bound in `std::iter::Iterator::sum`
27
28
LL | S: Sum<Self::Item>,
28
29
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
29
30
30
- error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
31
+ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
31
32
--> $DIR/invalid-iterator-chain.rs:10:9
32
33
|
33
34
LL | / vec![0, 1]
@@ -37,10 +38,11 @@ LL | | .map(|x| x as f64)
37
38
... |
38
39
LL | | .map(|x| { x + 1 })
39
40
LL | | .map(|x| { x; })
40
- | |____________________________^ the trait `Sum<()>` is not implemented for `i32 `
41
+ | |____________________________^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()> `
41
42
LL | .sum::<i32>(),
42
43
| --- required by a bound introduced by this call
43
44
|
45
+ = help: the trait `Sum<()>` is not implemented for `i32`
44
46
= help: the following other types implement trait `Sum<A>`:
45
47
<i32 as Sum<&'a i32>>
46
48
<i32 as Sum>
@@ -69,7 +71,7 @@ note: required by a bound in `std::iter::Iterator::sum`
69
71
LL | S: Sum<Self::Item>,
70
72
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
71
73
72
- error[E0277]: the trait bound `i32: Sum<f64>` is not satisfied
74
+ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
73
75
--> $DIR/invalid-iterator-chain.rs:22:9
74
76
|
75
77
LL | / vec![0, 1]
@@ -78,10 +80,11 @@ LL | | .map(|x| x * 2)
78
80
LL | | .map(|x| x as f64)
79
81
LL | | .filter(|x| *x > 0.0)
80
82
LL | | .map(|x| { x + 1.0 })
81
- | |_________________________________^ the trait `Sum<f64>` is not implemented for `i32 `
83
+ | |_________________________________^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64> `
82
84
LL | .sum::<i32>(),
83
85
| --- required by a bound introduced by this call
84
86
|
87
+ = help: the trait `Sum<f64>` is not implemented for `i32`
85
88
= help: the following other types implement trait `Sum<A>`:
86
89
<i32 as Sum<&'a i32>>
87
90
<i32 as Sum>
@@ -106,14 +109,15 @@ note: required by a bound in `std::iter::Iterator::sum`
106
109
LL | S: Sum<Self::Item>,
107
110
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
108
111
109
- error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
112
+ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
110
113
--> $DIR/invalid-iterator-chain.rs:30:20
111
114
|
112
115
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
113
116
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
114
117
| |
115
- | the trait `Sum<()>` is not implemented for `i32 `
118
+ | value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()> `
116
119
|
120
+ = help: the trait `Sum<()>` is not implemented for `i32`
117
121
= help: the following other types implement trait `Sum<A>`:
118
122
<i32 as Sum<&'a i32>>
119
123
<i32 as Sum>
@@ -131,14 +135,15 @@ note: required by a bound in `std::iter::Iterator::sum`
131
135
LL | S: Sum<Self::Item>,
132
136
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
133
137
134
- error[E0277]: the trait bound `i32: Sum< &()>` is not satisfied
138
+ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type ` &()`
135
139
--> $DIR/invalid-iterator-chain.rs:31:20
136
140
|
137
141
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
138
142
| ^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
139
143
| |
140
- | the trait `Sum<&()>` is not implemented for `i32 `
144
+ | value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()> `
141
145
|
146
+ = help: the trait `Sum<&()>` is not implemented for `i32`
142
147
= help: the following other types implement trait `Sum<A>`:
143
148
<i32 as Sum<&'a i32>>
144
149
<i32 as Sum>
0 commit comments