-
Notifications
You must be signed in to change notification settings - Fork 13.6k
update array missing IntoIterator
msg
#82626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
IntoIterator
msg
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,43 +13,43 @@ error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator | |
--> $DIR/array-of-ranges.rs:4:14 | ||
| | ||
LL | for _ in [0..=1] {} | ||
| ^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | ||
| ^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)` | ||
| | ||
= help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]` | ||
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` | ||
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details | ||
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]` | ||
= note: required by `into_iter` | ||
|
||
error[E0277]: `[RangeFrom<{integer}>; 1]` is not an iterator | ||
--> $DIR/array-of-ranges.rs:6:14 | ||
| | ||
LL | for _ in [0..] {} | ||
| ^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | ||
| ^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)` | ||
| | ||
= help: the trait `Iterator` is not implemented for `[RangeFrom<{integer}>; 1]` | ||
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` | ||
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details | ||
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeFrom<{integer}>; 1]` | ||
= note: required by `into_iter` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the array of ranges cases, it might make sense for us to suggest that maybe they didn't want the outer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like we already had a check for those cases https://github.com/rust-lang/rust/pull/82626/files#diff-c552b2bf18fb3212fe93dd601ce487badf5e50faf9aeed4db7b0f6c22571ef01L28-L33 Maybe at some point inference broke and instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AH! It broke not because of that, but because of 07e7823 and there being a single There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, fixed that |
||
|
||
error[E0277]: `[RangeTo<{integer}>; 1]` is not an iterator | ||
--> $DIR/array-of-ranges.rs:8:14 | ||
| | ||
LL | for _ in [..1] {} | ||
| ^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | ||
| ^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)` | ||
| | ||
= help: the trait `Iterator` is not implemented for `[RangeTo<{integer}>; 1]` | ||
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` | ||
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details | ||
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeTo<{integer}>; 1]` | ||
= note: required by `into_iter` | ||
|
||
error[E0277]: `[RangeToInclusive<{integer}>; 1]` is not an iterator | ||
--> $DIR/array-of-ranges.rs:10:14 | ||
| | ||
LL | for _ in [..=1] {} | ||
| ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | ||
| ^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)` | ||
| | ||
= help: the trait `Iterator` is not implemented for `[RangeToInclusive<{integer}>; 1]` | ||
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` | ||
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details | ||
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeToInclusive<{integer}>; 1]` | ||
= note: required by `into_iter` | ||
|
||
|
@@ -79,21 +79,21 @@ error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator | |
--> $DIR/array-of-ranges.rs:19:14 | ||
| | ||
LL | for _ in [0..1, 2..3] {} | ||
| ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | ||
| ^^^^^^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)` | ||
| | ||
= help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]` | ||
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` | ||
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details | ||
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 2]` | ||
= note: required by `into_iter` | ||
|
||
error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator | ||
--> $DIR/array-of-ranges.rs:21:14 | ||
| | ||
LL | for _ in [0..=1] {} | ||
| ^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | ||
| ^^^^^^^ arrays do not yet implement `IntoIterator`; try using `std::array::IntoIter::new(arr)` | ||
| | ||
= help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]` | ||
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` | ||
= note: see <https://github.com/rust-lang/rust/pull/65819> for more details | ||
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]` | ||
= note: required by `into_iter` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to suggest the
&
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, i wasn't sure how to explain that in a concise way, as adding
&
changes the element type.Do you have an idea for a second label here?