1
1
error[E0277]: a value of type `Vec<X>` cannot be built from an iterator over elements of type `&X`
2
- --> $DIR/invalid-iterator-chain-fixable.rs:7 :7
2
+ --> $DIR/invalid-iterator-chain-fixable.rs:8 :7
3
3
|
4
4
LL | let i = i.map(|x| x.clone());
5
5
| ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone`
@@ -10,7 +10,7 @@ LL | i.collect()
10
10
but trait `FromIterator<_>` is implemented for it
11
11
= help: for that trait implementation, expected `X`, found `&X`
12
12
note: the method call chain might not have had the expected associated types
13
- --> $DIR/invalid-iterator-chain-fixable.rs:5 :26
13
+ --> $DIR/invalid-iterator-chain-fixable.rs:6 :26
14
14
|
15
15
LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> {
16
16
| ^^^^^^^^^^^ `Iterator::Item` is `&X` here
@@ -24,7 +24,7 @@ LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
24
24
| ++++++++++++++
25
25
26
26
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
27
- --> $DIR/invalid-iterator-chain-fixable.rs:17 :33
27
+ --> $DIR/invalid-iterator-chain-fixable.rs:18 :33
28
28
|
29
29
LL | println!("{}", scores.sum::<i32>());
30
30
| --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
@@ -36,7 +36,7 @@ LL | println!("{}", scores.sum::<i32>());
36
36
`i32` implements `Sum<&i32>`
37
37
`i32` implements `Sum`
38
38
note: the method call chain might not have had the expected associated types
39
- --> $DIR/invalid-iterator-chain-fixable.rs:14 :10
39
+ --> $DIR/invalid-iterator-chain-fixable.rs:15 :10
40
40
|
41
41
LL | let v = vec![(0, 0)];
42
42
| ------------ this expression has type `Vec<({integer}, {integer})>`
@@ -57,7 +57,7 @@ LL + a + b
57
57
|
58
58
59
59
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
60
- --> $DIR/invalid-iterator-chain-fixable.rs:25 :20
60
+ --> $DIR/invalid-iterator-chain-fixable.rs:26 :20
61
61
|
62
62
LL | .sum::<i32>(),
63
63
| --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
@@ -69,7 +69,7 @@ LL | .sum::<i32>(),
69
69
`i32` implements `Sum<&i32>`
70
70
`i32` implements `Sum`
71
71
note: the method call chain might not have had the expected associated types
72
- --> $DIR/invalid-iterator-chain-fixable.rs:23 :14
72
+ --> $DIR/invalid-iterator-chain-fixable.rs:24 :14
73
73
|
74
74
LL | vec![0, 1]
75
75
| ---------- this expression has type `Vec<{integer}>`
@@ -90,7 +90,7 @@ LL + .map(|x| { x })
90
90
|
91
91
92
92
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
93
- --> $DIR/invalid-iterator-chain-fixable.rs:27 :60
93
+ --> $DIR/invalid-iterator-chain-fixable.rs:28 :60
94
94
|
95
95
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
96
96
| --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
@@ -102,7 +102,7 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
102
102
`i32` implements `Sum<&i32>`
103
103
`i32` implements `Sum`
104
104
note: the method call chain might not have had the expected associated types
105
- --> $DIR/invalid-iterator-chain-fixable.rs:27 :38
105
+ --> $DIR/invalid-iterator-chain-fixable.rs:28 :38
106
106
|
107
107
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
108
108
| ---------- ------ ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
@@ -118,7 +118,7 @@ LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>());
118
118
|
119
119
120
120
error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()`
121
- --> $DIR/invalid-iterator-chain-fixable.rs:36 :25
121
+ --> $DIR/invalid-iterator-chain-fixable.rs:37 :25
122
122
|
123
123
LL | let g: Vec<i32> = f.collect();
124
124
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
@@ -127,7 +127,7 @@ LL | let g: Vec<i32> = f.collect();
127
127
but trait `FromIterator<i32>` is implemented for it
128
128
= help: for that trait implementation, expected `i32`, found `()`
129
129
note: the method call chain might not have had the expected associated types
130
- --> $DIR/invalid-iterator-chain-fixable.rs:32 :15
130
+ --> $DIR/invalid-iterator-chain-fixable.rs:33 :15
131
131
|
132
132
LL | let a = vec![0];
133
133
| ------- this expression has type `Vec<{integer}>`
0 commit comments