Open
Description
-
array::IntoIter
type: Tracking issue for by-value array iterator (featurearray_value_iter
) #65798 - Idea to make
.into_iter()
resolution edition dependent: exploration: ignoring arrays in method dispatch #84133 - FCP: Cautiously add IntoIterator for arrays by value #84147 (comment)
- IntoIterator implementation for arrays:
AddIncluded in Cautiously add IntoIterator for arrays by value #84147IntoIterator
impl for arrays by value (for [T; N]
) #65819 - Ignore the by-value
.into_iter()
in method resolution on Rust 2015 and Rust 2018: Cautiously add IntoIterator for arrays by value #84147 - Update
array_into_iter
lint.- Change the "might change in the future" wording: Update array_into_iter lint for 1.53 and edition changes. #85682
- Correct wording for the current situation in the message (arrays do implement the trait, the method is just hiding itself in
a.into_iter()
syntax for backwards compatibility): Update array_into_iter lint for 1.53 and edition changes. #85682 - Also suggest just removing
.into_iter()
infor a in [1, 2, 3].into_iter()
, since that now works on all editions: Update array_into_iter lint for 1.53 and edition changes. #85682 - Also suggest
IntoIterator::into_iter(array)
: Update array_into_iter lint for 1.53 and edition changes. #85682 - Extend lint to also cover this case and this case? Upgrade array_into_iter lint to include Deref-to-array types. #88512
- Update documentation
- Update array and iterator docs in std / core for new IntoIterator impl and edition. #87701
- Point out that behaviour might be switched on 2015 and 2018 too one day - Point out that behavior might be switched on 2015 and 2018 too one day #84590
- Fix docs of
array::IntoIter::new
(the ".. in the future, after .." part): Update outdated docs of array::IntoIter::new. #88610 - Update docs of the
array
primitive type - Update primitive docs for rust 2021. #88613
- Update the book (e.g. this section and probably more, and many examples).
- Update array and iterator docs in std / core for new IntoIterator impl and edition. #87701
- Update standard library
- Remove usages of
array::IntoIter::new
: Update standard library for IntoIterator implementation of arrays #85930 - Update expressions like like
.chain(array.iter().cloned())
to just.chain(array)
since that now works on all editions. (Same forzip
,extend
etc.): Update standard library for IntoIterator implementation of arrays #85930 - Use
.extend(array)
andfrom_iter(array)
wherever that simplifies things. - Remove
arrays do not yet implement IntoIterator
message from Iterator trait: Remove arrays/IntoIterator message from Iterator trait. #85670 - Remove
for _ in [start..end]
messages from Iterator trait. (Could use a new clippy lint?): Remove Iterator #[rustc_on_unimplemented]s that no longer apply. #85689
- Remove usages of
- Deprecate
array::IntoIter::new
(IntoIterator::into_iter([1,2,3])
now works too on all editions.): Deprecate array::IntoIter::new. #88611
Once edition 2021 is stable:
- Update examples like this to use arrays by value. (
Some(&1)
→Some(1)
etc.)- Update examples to no longer avoid iterating arrays. (Many doctest examples are using iterators over e.g.
&i32
instead of justi32
.)
- Update examples to no longer avoid iterating arrays. (Many doctest examples are using iterators over e.g.
- Remove about 200 usages of
.iter().copied()
and.iter().cloned()
from examples and tests.
Unresolved questions:
- Do something about the 'copying large arrays' footgun. (Add
IntoIterator
implementation forBox<[T; N]>
etc? Add lint about big copies?)
Metadata
Metadata
Assignees
Labels
Area: `[T; N]`Area: Documentation for any part of the project, including the compiler, standard library, and toolsArea: The 2021 editionArea: IteratorsCategory: An issue tracking the progress of sth. like the implementation of an RFCRelevant to the library team, which will review and decide on the PR/issue.