Rust 1.53.0, released on June 17, 2021, lets developers pass arrays by value into ordinary for loops and functions expecting IntoIterator. One familiar spelling still behaves differently: in Rust’s 2015 and 2018 editions, array.into_iter() continues to iterate by reference. Upgrading the compiler alone does not turn those existing method calls into ownership transfers. [S1][S2]
The new capability is the IntoIterator trait implementation for arrays. It allows a fixed-size array to feed an iterator chain or a function accepting that trait directly, instead of requiring a reference to the array. It is not the first way Rust has offered to iterate over array values: the versioned library documentation lists the explicit array::IntoIter route as available from Rust 1.51. [S1][S2]
The apparent inconsistency is deliberate. Before 1.53, array.into_iter() already compiled because Rust could resolve the call through a reference to the array. The release preserves that resolution for method-call syntax to avoid breaking existing code. The distinction is visible in the item type: reference iteration yields &T, while the new consuming implementation yields T. [S1][S2]
When the intention is to keep borrowing, array.iter() makes that choice explicit. Rust’s 1.53 documentation shows the array_into_iter lint suggesting this change for future compatibility. When the intention is to consume the array, IntoIterator::into_iter(array) or a direct for item in array loop selects by-value iteration without relying on the special-cased method call. A maintainer reviewing these edits needs to check the intended item type, rather than treat every iterator spelling as interchangeable. [S1][S2]
Consumption also changes what can happen afterward. The library documentation says the by-value iterator moves each element out of the array, and the array cannot then be used unless its element type implements Copy. In that exception, the whole array is copied. This qualification matters when reviewing a migration: an example whose element type implements Copy does not establish that an array of non-Copy elements can still be reused after the same change. [S2]
An edition migration is a separate decision. In the June announcement, the Rust team says the planned Rust 2021 edition will remove the method-call exception, so array.into_iter() will iterate by value there. That edition is still scheduled for later in 2021, not delivered by the 1.53 stable release. Teams can prepare by making reference iteration explicit now; the versioned documentation also warns against assuming the old-edition exception will remain unchanged in every future language version. [S1][S2]
Source documents
- Rust 1.53 release announcementhttps://blog.rust-lang.org/2021/06/17/Rust-1.53.0/
- Rust 1.53.0 standard library: arrayhttps://doc.rust-lang.org/1.53.0/std/primitive.array.html
