Skip to content

Commit addc51a

Browse files
committed
update array missing IntoIterator msg
1 parent 5e65467 commit addc51a

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

library/core/src/iter/traits/iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
8181
),
8282
on(
8383
_Self = "[]",
84-
label = "borrow the array with `&` or call `.iter()` on it to iterate over it",
85-
note = "arrays are not iterators, but slices like the following are: `&[1, 2, 3]`"
84+
label = "arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`",
85+
note = "see <https://github.com/rust-lang/rust/pull/65819> for more details"
8686
),
8787
on(
8888
_Self = "{integral}",

src/test/ui/iterators/array-of-ranges.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,43 @@ error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator
1313
--> $DIR/array-of-ranges.rs:4:14
1414
|
1515
LL | for _ in [0..=1] {}
16-
| ^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
16+
| ^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
1717
|
1818
= 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: see <https://github.com/rust-lang/rust/pull/65819> for more details
2020
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]`
2121
= note: required by `into_iter`
2222

2323
error[E0277]: `[RangeFrom<{integer}>; 1]` is not an iterator
2424
--> $DIR/array-of-ranges.rs:6:14
2525
|
2626
LL | for _ in [0..] {}
27-
| ^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
27+
| ^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
2828
|
2929
= 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: see <https://github.com/rust-lang/rust/pull/65819> for more details
3131
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeFrom<{integer}>; 1]`
3232
= note: required by `into_iter`
3333

3434
error[E0277]: `[RangeTo<{integer}>; 1]` is not an iterator
3535
--> $DIR/array-of-ranges.rs:8:14
3636
|
3737
LL | for _ in [..1] {}
38-
| ^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
38+
| ^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
3939
|
4040
= 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: see <https://github.com/rust-lang/rust/pull/65819> for more details
4242
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeTo<{integer}>; 1]`
4343
= note: required by `into_iter`
4444

4545
error[E0277]: `[RangeToInclusive<{integer}>; 1]` is not an iterator
4646
--> $DIR/array-of-ranges.rs:10:14
4747
|
4848
LL | for _ in [..=1] {}
49-
| ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
49+
| ^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
5050
|
5151
= 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: see <https://github.com/rust-lang/rust/pull/65819> for more details
5353
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeToInclusive<{integer}>; 1]`
5454
= note: required by `into_iter`
5555

@@ -79,21 +79,21 @@ error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator
7979
--> $DIR/array-of-ranges.rs:19:14
8080
|
8181
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)`
8383
|
8484
= 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
8686
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 2]`
8787
= note: required by `into_iter`
8888

8989
error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator
9090
--> $DIR/array-of-ranges.rs:21:14
9191
|
9292
LL | for _ in [0..=1] {}
93-
| ^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
93+
| ^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
9494
|
9595
= 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: see <https://github.com/rust-lang/rust/pull/65819> for more details
9797
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]`
9898
= note: required by `into_iter`
9999

src/test/ui/iterators/array.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ error[E0277]: `[{integer}; 2]` is not an iterator
22
--> $DIR/array.rs:2:14
33
|
44
LL | for _ in [1, 2] {}
5-
| ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
5+
| ^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
66
|
77
= help: the trait `Iterator` is not implemented for `[{integer}; 2]`
8-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
8+
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details
99
= note: required because of the requirements on the impl of `IntoIterator` for `[{integer}; 2]`
1010
= note: required by `into_iter`
1111

1212
error[E0277]: `[{integer}; 2]` is not an iterator
1313
--> $DIR/array.rs:5:14
1414
|
1515
LL | for _ in x {}
16-
| ^ borrow the array with `&` or call `.iter()` on it to iterate over it
16+
| ^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
1717
|
1818
= help: the trait `Iterator` is not implemented for `[{integer}; 2]`
19-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
19+
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details
2020
= note: required because of the requirements on the impl of `IntoIterator` for `[{integer}; 2]`
2121
= note: required by `into_iter`
2222

2323
error[E0277]: `[{float}; 2]` is not an iterator
2424
--> $DIR/array.rs:7:14
2525
|
2626
LL | for _ in [1.0, 2.0] {}
27-
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
27+
| ^^^^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)`
2828
|
2929
= help: the trait `Iterator` is not implemented for `[{float}; 2]`
30-
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
30+
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details
3131
= note: required because of the requirements on the impl of `IntoIterator` for `[{float}; 2]`
3232
= note: required by `into_iter`
3333

0 commit comments

Comments
 (0)