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
Rollup merge of rust-lang#82626 - lcnr:encode_with_shorthandb, r=estebank
update array missing `IntoIterator` msg
fixesrust-lang#82602
r? ``@estebank`` do you know whether we can use the expr span in `rustc_on_unimplemented`? The label isn't too great rn
Copy file name to clipboardexpand all lines: src/test/ui/iterators/array-of-ranges.stderr
+12-12
Original file line number
Diff line number
Diff line change
@@ -13,43 +13,43 @@ error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator
13
13
--> $DIR/array-of-ranges.rs:4:14
14
14
|
15
15
LL | for _ in [0..=1] {}
16
-
| ^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
16
+
| ^^^^^^^ if you meant to iterate between two values, remove the square brackets
17
17
|
18
18
= help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]`
19
-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
19
+
= note: `[start..=end]` is an array of one `RangeInclusive`; you might have meant to have a `RangeInclusive` without the brackets: `start..=end`
20
20
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]`
21
21
= note: required by `into_iter`
22
22
23
23
error[E0277]: `[RangeFrom<{integer}>; 1]` is not an iterator
24
24
--> $DIR/array-of-ranges.rs:6:14
25
25
|
26
26
LL | for _ in [0..] {}
27
-
| ^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
27
+
| ^^^^^ if you meant to iterate from a value onwards, remove the square brackets
28
28
|
29
29
= help: the trait `Iterator` is not implemented for `[RangeFrom<{integer}>; 1]`
30
-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
30
+
= note: `[start..]` is an array of one `RangeFrom`; you might have meant to have a `RangeFrom` without the brackets: `start..`, keeping in mind that iterating over an unbounded iterator will run forever unless you `break` or `return` from within the loop
31
31
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeFrom<{integer}>; 1]`
32
32
= note: required by `into_iter`
33
33
34
34
error[E0277]: `[RangeTo<{integer}>; 1]` is not an iterator
35
35
--> $DIR/array-of-ranges.rs:8:14
36
36
|
37
37
LL | for _ in [..1] {}
38
-
| ^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
38
+
| ^^^^^ if you meant to iterate until a value, remove the square brackets and add a starting value
39
39
|
40
40
= help: the trait `Iterator` is not implemented for `[RangeTo<{integer}>; 1]`
41
-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
41
+
= note: `[..end]` is an array of one `RangeTo`; you might have meant to have a bounded `Range` without the brackets: `0..end`
42
42
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeTo<{integer}>; 1]`
43
43
= note: required by `into_iter`
44
44
45
45
error[E0277]: `[RangeToInclusive<{integer}>; 1]` is not an iterator
46
46
--> $DIR/array-of-ranges.rs:10:14
47
47
|
48
48
LL | for _ in [..=1] {}
49
-
| ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
49
+
| ^^^^^^ if you meant to iterate until a value (including it), remove the square brackets and add a starting value
50
50
|
51
51
= help: the trait `Iterator` is not implemented for `[RangeToInclusive<{integer}>; 1]`
52
-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
52
+
= note: `[..=end]` is an array of one `RangeToInclusive`; you might have meant to have a bounded `RangeInclusive` without the brackets: `0..=end`
53
53
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeToInclusive<{integer}>; 1]`
54
54
= note: required by `into_iter`
55
55
@@ -79,21 +79,21 @@ error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator
79
79
--> $DIR/array-of-ranges.rs:19:14
80
80
|
81
81
LL | for _ in [0..1, 2..3] {}
82
-
| ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
82
+
| ^^^^^^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
83
83
|
84
84
= help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]`
85
-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
85
+
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details
86
86
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 2]`
87
87
= note: required by `into_iter`
88
88
89
89
error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator
90
90
--> $DIR/array-of-ranges.rs:21:14
91
91
|
92
92
LL | for _ in [0..=1] {}
93
-
| ^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
93
+
| ^^^^^^^ if you meant to iterate between two values, remove the square brackets
94
94
|
95
95
= help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]`
96
-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
96
+
= note: `[start..=end]` is an array of one `RangeInclusive`; you might have meant to have a `RangeInclusive` without the brackets: `start..=end`
97
97
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]`
0 commit comments