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

Implement IntoIterator for [&[mut]] Box<[T; N], A> #134021

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

WaffleLapkin
Copy link
Member

Revival of #124108

I copied the <[T; N] as IntoIterator>::Iter's impl, but this does not seem satisfying:

  1. I had to make IndexRange public
  2. this duplicates a lot of code
  3. it's unclear if the copied unsafe and spec code is worth it

r? @scottmcm
maybe you have better implementation ideas.

Specifically make it public + unstable under `std_internals` + `doc(hidden)`.
This is honestly Not Great, but I do not know a better solution :(
…>` and `[T; N]`

They'll be needed for `IntoIterator` impls.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 8, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Note: this removes warnings, as this breakage was deemed acceptable, see
<rust-lang#124108 (comment)>
i forgot that `#![doc(hidden)]` applies to the module, not everything in
it... again. (this caused linkchecker to fail, because of a debug impl)
@rust-log-analyzer

This comment has been minimized.

@tgross35 tgross35 added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Dec 13, 2024
@WaffleLapkin WaffleLapkin marked this pull request as ready for review December 16, 2024 19:24
@tgross35 tgross35 added the needs-fcp This change is insta-stable, so needs a completed FCP to proceed. label Dec 19, 2024
@bors
Copy link
Contributor

bors commented Feb 6, 2025

☔ The latest upstream changes (presumably #136572) made this pull request unmergeable. Please resolve the merge conflicts.

/// A by-value `Box<[T; N]>` iterator.
#[stable(feature = "boxed_array_value_iter", since = "CURRENT_RUSTC_VERSION")]
#[rustc_insignificant_dtor]
pub struct BoxedArrayIntoIter<T, const N: usize, A: Allocator = Global> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I was thinking that might possibly work to avoid the duplication would be something like this ancient experiment that I never really took anywhere: 8e6c148

Basically, have

type BoxedArrayIntoIter<T, const N: usize, A: Allocator = Global> = InternalVecOrBoxedArrayIntoIter<T, FixedCapacity<N>, A>;
type vec::IntoIter<T, A: Allocator = Global> = InternalVecOrBoxedArrayIntoIter<T, Cap, A>;

@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants