Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention IntoIterator special case for Box<[T]> for pre-Rust 2024 editions #1742

Open
xinyufort opened this issue Feb 25, 2025 · 1 comment
Open
Labels
A-edition-2024 Area: Edition 2024

Comments

@xinyufort
Copy link

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.

@ehuss
Copy link
Contributor

ehuss commented Feb 25, 2025

Thanks for the report! I vaguely recall discussing this, but don't remember why we skipped it. Looks like it should probably be included, though.

@ehuss ehuss added the A-edition-2024 Area: Edition 2024 label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: Edition 2024
Projects
None yet
Development

No branches or pull requests

2 participants