Implement IntoIterator for [&[mut]] Box<[T; N], A>#134021
Open
WaffleLapkin wants to merge 8 commits intorust-lang:mainfrom
Open
Implement IntoIterator for [&[mut]] Box<[T; N], A>#134021WaffleLapkin wants to merge 8 commits intorust-lang:mainfrom
IntoIterator for [&[mut]] Box<[T; N], A>#134021WaffleLapkin wants to merge 8 commits intorust-lang:mainfrom
Conversation
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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)
6f3a44b to
576e704
Compare
This comment has been minimized.
This comment has been minimized.
Collaborator
|
☔ The latest upstream changes (presumably #136572) made this pull request unmergeable. Please resolve the merge conflicts. |
scottmcm
reviewed
Feb 24, 2025
Member
Author
|
@scottmcm anything I can do to move this forward? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Mark-Simulacrum
requested changes
Feb 14, 2026
| // The iterator indeed reports the correct length. The number of "alive" | ||
| // elements (that will still be yielded) is the length of the range `alive`. | ||
| // This range is decremented in length in either `next` or `next_back`. It is | ||
| // always decremented by 1 in those methods, but only if `Some(_)` is returned. |
Member
There was a problem hiding this comment.
"It is always decremented[...], but only if" seems like odd phrasing. I think we can just delete this sentence?
|
|
||
| let mut new = Self { | ||
| data: Box::new_in( | ||
| [const { MaybeUninit::uninit() }; N], |
Member
There was a problem hiding this comment.
nit: should this use the uninit constructors to avoid the memcpy given large N?
|
|
||
| #[doc(hidden)] | ||
| #[unstable(issue = "none", feature = "std_internals")] | ||
| unsafe impl<T, const N: usize, A: Allocator> TrustedRandomAccessNoCoerce |
Member
There was a problem hiding this comment.
I think it'd be good for this to have a SAFETY comment.
Member
There was a problem hiding this comment.
Should this get the same treatment as array IntoIterator did? Maybe starting with edition next (~2026/2027)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revival of #124108
I copied the
<[T; N] as IntoIterator>::Iter's impl, but this does not seem satisfying:IndexRangepublicr? @scottmcm
maybe you have better implementation ideas.