You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/ui/iterators/invalid-iterator-chain.stderr
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,10 @@ error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
34
34
|
35
35
LL | / vec![0, 1]
36
36
LL | | .iter()
37
+
LL | | .map(|x| x * 2)
38
+
LL | | .map(|x| x as f64)
39
+
... |
40
+
LL | | .map(|x| { x + 1 })
37
41
LL | | .map(|x| { x; })
38
42
| |____________________________^ the trait `Sum<()>` is not implemented for `i32`
39
43
LL | .sum::<i32>(),
@@ -42,13 +46,23 @@ LL | .sum::<i32>(),
42
46
= help: the following other types implement trait `Sum<A>`:
43
47
<i32 as Sum<&'a i32>>
44
48
<i32 as Sum>
45
-
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/invalid-iterator-chain.rs:12:18: 12:21]>`
46
-
--> $DIR/invalid-iterator-chain.rs:12:14
49
+
note: the expression is of type `Map<Map<Filter<Map<Map<Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/invalid-iterator-chain.rs:12:18: 12:21]>, [closure@$DIR/invalid-iterator-chain.rs:13:18: 13:21]>, [closure@$DIR/invalid-iterator-chain.rs:14:18: 14:21]>, [closure@$DIR/invalid-iterator-chain.rs:15:21: 15:24]>, [closure@$DIR/invalid-iterator-chain.rs:16:18: 16:21]>, [closure@$DIR/invalid-iterator-chain.rs:17:18: 17:21]>`
50
+
--> $DIR/invalid-iterator-chain.rs:17:14
47
51
|
48
52
LL | vec![0, 1]
49
53
| ---------- this expression has type `Vec<{integer}>`
50
54
LL | .iter()
51
55
| ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
56
+
LL | .map(|x| x * 2)
57
+
| -------------- associated type `std::iter::Iterator::Item` is `{integer}` here
58
+
LL | .map(|x| x as f64)
59
+
| ----------------- associated type `std::iter::Iterator::Item` is `f64` here
60
+
LL | .map(|x| x as i64)
61
+
| ----------------- associated type `std::iter::Iterator::Item` is `i64` here
62
+
LL | .filter(|x| *x > 0)
63
+
| ------------------ associated type `std::iter::Iterator::Item` is `i64` here
64
+
LL | .map(|x| { x + 1 })
65
+
| ------------------ associated type `std::iter::Iterator::Item` is `i64` here
52
66
LL | .map(|x| { x; })
53
67
| ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
54
68
note: required by a bound in `std::iter::Iterator::sum`
@@ -58,7 +72,7 @@ LL | S: Sum<Self::Item>,
58
72
| ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum`
59
73
60
74
error[E0277]: the trait bound `i32: Sum<()>` is not satisfied
0 commit comments