-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-maybe-future-editionSomething we may consider for a future edition.Something we may consider for a future edition.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-langRelevant to the language teamRelevant to the language team
Description
In #65819, we are considering adding an impl of IntoIterator
for [T; N]
for all N
. However, this breaks existing code that relies on method dispatch:
let array = [true; 3];
for x in array.into_iter() {
let _ = *x; // x is a reference
}
In this code, array.into_iter()
winds up unsizing to a slice and hence resolving to <&[bool] as IntoIterator>::into_iter
(and thus executing on refs to booleans). This issue describes a possible modification to older Rust editions that would allow us to add the impl without breaking existing code or compromising our edition guarantees.
Metadata
Metadata
Assignees
Labels
A-maybe-future-editionSomething we may consider for a future edition.Something we may consider for a future edition.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-langRelevant to the language teamRelevant to the language team