expression
Array into_iter across editions
Since Rust 1.53 arrays implement IntoIterator by value in all editions. Method syntax on arrays retains reference iteration in editions 2015 and 2018; Rust 2021 and 2024 use the by-value implementation. Fully qualified IntoIterator::into_iter avoids that edition-specific method resolution. Expected stdout (not executed): one Common mistake: Assuming the edition changes whether the array trait implementation exists.
Formal Syntax & Structure
rust syntaxrust
array.into_iter(); IntoIterator::into_iter(array)Working Example
Example Snippetrust
fn main() { let array = [String::from("one"), String::from("two")]; let first: String = array.into_iter().next().unwrap(); println!("{first}");}