rust-lang / rust-lang/reference
Mention `IntoIterator` special case for `Box<[T]>` for pre-Rust 2024 editions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- PR merge metrics
- PR metrics pending
Description
Apologies if this has already been raised elsewhere, or if this is a non-issue.
I noticed that the current reference, under the section for "Method call expressions," only mentions the edition-specific handling of the into_iter() method call stemming from the introduction of IntoIterator trait for arrays. (Here is the link to the relevant PR that updated the Reference.)
Now that there's a similar change in Rust 2024 (as per this page on the Edition Guide), perhaps the Reference needs to be updated again? Specifically, I'm referring to this section:
However, this would normally be a breaking change because existing code that manually called .into_iter() on a boxed slice would change from having an iterator over references to an iterator over values. To resolve this problem, method calls of .into_iter() on boxed slices have edition-dependent behavior. In editions before 2024, it continues to return an iterator over references, and starting in Edition 2024 it returns an iterator over values.
If needed, I can help open a PR for this.
For what it's worth, I see that on the tracking issue for adding IntoIterator for Box<[T]> in Rust 2024, the step "Add documentation to the reference" is marked as "N/A." I don't know if that was intentional or not.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Reference's method call expressions section and compare its existing edition-specific IntoIterator discussion with the Rust 2024 Edition Guide page on IntoIterator for boxed slices. Update the Reference so the pre-2024 and 2024 behavior is documented, then verify that the wording matches the linked edition guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100