Skip to content

Commit 39dc2c4

Browse files
authored
Rollup merge of rust-lang#56907 - rumajo:master, r=kennytm,Centril
Fix grammar in compiler error for array iterators This fixes a small grammatical mistake in the message the compiler gives when attempting to iterate directly over an array `arr` without calling `arr.iter()` or borrowing `&arr`.
2 parents b08a52c + fca03e0 commit 39dc2c4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/libcore/iter/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}
8787
on(
8888
_Self="[]",
8989
label="borrow the array with `&` or call `.iter()` on it to iterate over it",
90-
note="arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`"
90+
note="arrays are not iterators, but slices like the following are: `&[1, 2, 3]`"
9191
),
9292
on(
9393
_Self="{integral}",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ LL | for _ in [0..1, 2..3] {}
7575
| ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
7676
|
7777
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]`
78-
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
78+
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
7979
= note: required by `std::iter::IntoIterator::into_iter`
8080

8181
error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator

src/test/ui/iterators/array.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | for _ in [1, 2] {}
55
| ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
66
|
77
= help: the trait `std::iter::Iterator` is not implemented for `[{integer}; 2]`
8-
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
8+
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
99
= note: required by `std::iter::IntoIterator::into_iter`
1010

1111
error[E0277]: `[{integer}; 2]` is not an iterator
@@ -15,7 +15,7 @@ LL | for _ in x {}
1515
| ^ borrow the array with `&` or call `.iter()` on it to iterate over it
1616
|
1717
= help: the trait `std::iter::Iterator` is not implemented for `[{integer}; 2]`
18-
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
18+
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
1919
= note: required by `std::iter::IntoIterator::into_iter`
2020

2121
error[E0277]: `[{float}; 2]` is not an iterator
@@ -25,7 +25,7 @@ LL | for _ in [1.0, 2.0] {}
2525
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
2626
|
2727
= help: the trait `std::iter::Iterator` is not implemented for `[{float}; 2]`
28-
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
28+
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
2929
= note: required by `std::iter::IntoIterator::into_iter`
3030

3131
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)