Skip to content

Commit 8d9ffa3

Browse files
committed
fix rebase
1 parent 78f9759 commit 8d9ffa3

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

src/test/ui/iterators/invalid-iterator-chain.stderr

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
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 `()`
22
--> $DIR/invalid-iterator-chain.rs:7:20
33
|
44
LL | println!("{}", scores.sum::<i32>());
55
| ^^^^^^ --- required by a bound introduced by this call
66
| |
7-
| the trait `Sum<()>` is not implemented for `i32`
7+
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
88
|
9+
= help: the trait `Sum<()>` is not implemented for `i32`
910
= help: the following other types implement trait `Sum<A>`:
1011
<i32 as Sum<&'a i32>>
1112
<i32 as Sum>
@@ -27,7 +28,7 @@ note: required by a bound in `std::iter::Iterator::sum`
2728
LL | S: Sum<Self::Item>,
2829
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
2930

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 `()`
3132
--> $DIR/invalid-iterator-chain.rs:10:9
3233
|
3334
LL | / vec![0, 1]
@@ -37,10 +38,11 @@ LL | | .map(|x| x as f64)
3738
... |
3839
LL | | .map(|x| { x + 1 })
3940
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=()>`
4142
LL | .sum::<i32>(),
4243
| --- required by a bound introduced by this call
4344
|
45+
= help: the trait `Sum<()>` is not implemented for `i32`
4446
= help: the following other types implement trait `Sum<A>`:
4547
<i32 as Sum<&'a i32>>
4648
<i32 as Sum>
@@ -69,7 +71,7 @@ note: required by a bound in `std::iter::Iterator::sum`
6971
LL | S: Sum<Self::Item>,
7072
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
7173

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`
7375
--> $DIR/invalid-iterator-chain.rs:22:9
7476
|
7577
LL | / vec![0, 1]
@@ -78,10 +80,11 @@ LL | | .map(|x| x * 2)
7880
LL | | .map(|x| x as f64)
7981
LL | | .filter(|x| *x > 0.0)
8082
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>`
8284
LL | .sum::<i32>(),
8385
| --- required by a bound introduced by this call
8486
|
87+
= help: the trait `Sum<f64>` is not implemented for `i32`
8588
= help: the following other types implement trait `Sum<A>`:
8689
<i32 as Sum<&'a i32>>
8790
<i32 as Sum>
@@ -106,14 +109,15 @@ note: required by a bound in `std::iter::Iterator::sum`
106109
LL | S: Sum<Self::Item>,
107110
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
108111

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 `()`
110113
--> $DIR/invalid-iterator-chain.rs:30:20
111114
|
112115
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
113116
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
114117
| |
115-
| the trait `Sum<()>` is not implemented for `i32`
118+
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
116119
|
120+
= help: the trait `Sum<()>` is not implemented for `i32`
117121
= help: the following other types implement trait `Sum<A>`:
118122
<i32 as Sum<&'a i32>>
119123
<i32 as Sum>
@@ -131,14 +135,15 @@ note: required by a bound in `std::iter::Iterator::sum`
131135
LL | S: Sum<Self::Item>,
132136
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
133137

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 `&()`
135139
--> $DIR/invalid-iterator-chain.rs:31:20
136140
|
137141
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
138142
| ^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
139143
| |
140-
| the trait `Sum<&()>` is not implemented for `i32`
144+
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
141145
|
146+
= help: the trait `Sum<&()>` is not implemented for `i32`
142147
= help: the following other types implement trait `Sum<A>`:
143148
<i32 as Sum<&'a i32>>
144149
<i32 as Sum>

src/test/ui/on-unimplemented/sum.stderr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ LL | vec![(), ()].iter().sum::<i32>();
1010
= help: the following other types implement trait `Sum<A>`:
1111
<i32 as Sum<&'a i32>>
1212
<i32 as Sum>
13+
note: the method call chain might not have had the expected associated types
14+
--> $DIR/sum.rs:4:18
15+
|
16+
LL | vec![(), ()].iter().sum::<i32>();
17+
| ------------ ^^^^^^ `std::iter::Iterator::Item` is `&()` here
18+
| |
19+
| this expression has type `Vec<()>`
1320
note: required by a bound in `std::iter::Iterator::sum`
1421
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
1522
|
@@ -28,6 +35,13 @@ LL | vec![(), ()].iter().product::<i32>();
2835
= help: the following other types implement trait `Product<A>`:
2936
<i32 as Product<&'a i32>>
3037
<i32 as Product>
38+
note: the method call chain might not have had the expected associated types
39+
--> $DIR/sum.rs:7:18
40+
|
41+
LL | vec![(), ()].iter().product::<i32>();
42+
| ------------ ^^^^^^ `std::iter::Iterator::Item` is `&()` here
43+
| |
44+
| this expression has type `Vec<()>`
3145
note: required by a bound in `std::iter::Iterator::product`
3246
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
3347
|

0 commit comments

Comments
 (0)