-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
IntoIterator should be implemented for [T; N] not just references #25725
Copy link
Copy link
Closed
Labels
A-iteratorsArea: IteratorsArea: IteratorsC-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-iteratorsArea: IteratorsArea: IteratorsC-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently IntoIterator is implemented for arrays of
&'a mut [T; N]and&'a [T; N]but not for[T; N]making it only possible tocollect()arrays of references, not arrays of values:This is something users are likely to run headlong into (probably accidentally) when testing out examples from the iterator docs. So, IntoIterator should be implemented so that last option is possible. The API stabilization RFC: rust-lang/rfcs#1105 states:
Meaning this would be allowed as a minor change in spite of
[1, 2].into_iter()behavior changing because it could be changed beforehand to[1, 2].iter().