Skip to content

Use slice::iter instead of into_iter to avoid future breakage #225

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

Closed
wants to merge 1 commit into from

Conversation

Aaron1011
Copy link

@Aaron1011 Aaron1011 commented Oct 30, 2019

an_array.into_iter() currently just works because of the autoref
feature, which then calls <[T] as IntoIterator>::into_iter. But
in the future, arrays will implement IntoIterator, too. In order
to avoid problems in the future, the call is replaced by iter()
which is shorter and more explicit.

See rust-lang/rust#65819 for more information

`an_array.into_iter()` currently just works because of the autoref
feature, which then calls `<[T] as IntoIterator>::into_iter`. But
in the future, arrays will implement `IntoIterator`, too. In order
to avoid problems in the future, the call is replaced by `iter()`
which is shorter and more explicit.
@frankmcsherry
Copy link
Member

Thanks for the PR. The into_iter() implementation is intentional, and when you land the IntoIterator implementation for arrays it is actually what I want. So, there shouldn't be a break unless you also land the lint that makes this a hard error. That would be breaking.

@frankmcsherry
Copy link
Member

This was fixed with array::IntoIter in Rust 1.51. Thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants