-
Notifications
You must be signed in to change notification settings - Fork 13.4k
impl Default
for array::IntoIter
#141574
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
impl Default
for array::IntoIter
#141574
Conversation
@rust-lang/libs-api |
ACP is primarily to avoid unnecessary implementation effort, which is trivial here. I don't see any issue with going straight to FCP for this. Nominating for team discussion. |
It feels somewhat surprising to me that the default value of an array iterator would be empty instead of |
@rfcbot fcp merge |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This "feels" slightly odd to me. From what I can tell, this I think the thing that makes me feel uneasy about this is that this makes it so I'm not necessarily advocating for returning |
I mean... You can already do the following on stable: fn empty<T: Default + Copy, const N: usize>() -> std::array::IntoIter<T, N> {
let mut iter = [T::default(); N].into_iter();
iter.by_ref().for_each(|_| {});
iter
} |
Yeah I guess that renders my concern there moot. That was my poor attempt at articulating my feeling here. It doesn't get rid of my sense of this being a bit weird to me. I guess I'm just echoing @BoxyUwU here, but I'm not convinced that adding the impl at all is worth it. I don't feel strongly enough to render an objection though. |
Well sure, there is a bit of a difference here: for for Here But I can see arguments on both sides but I felt that an empty iterator was stronger. Ability to use |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
In the original ACP adding Default impls for iterators I intentionally skipped this one because the meaning is ambiguous. |
Interesting. Maybe another way to think of it is that |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Reading through this PR, it looks like there aren't any blocking concerns (as @BurntSushi explicitly opted not to block). Merging as FCP accepted. @bors r+ rollup |
Rollup of 14 pull requests Successful merges: - #141574 (impl `Default` for `array::IntoIter`) - #141608 (Add support for repetition to `proc_macro::quote`) - #142100 (rustdoc: make srcIndex no longer a global variable) - #142371 (avoid `&mut P<T>` in `visit_expr` etc methods) - #142517 (Windows: Use anonymous pipes in Command) - #142520 (alloc: less static mut + some cleanup) - #142588 (Generic ctx imprv) - #142605 (Don't unwrap in enzyme builds in case of missing llvm-config) - #142608 (Refresh module-level docs for `rustc_target::spec`) - #142618 (Lint about `console` calls in rustdoc JS) - #142620 (Remove a panicking branch in `BorrowedCursor::advance`) - #142631 (Dont suggest remove semi inside macro expansion for redundant semi lint) - #142632 (Update cargo) - #142635 (Temporarily add back -Zwasm-c-abi=spec) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #141574 - fee1-dead-contrib:push-owzulzmzszzx, r=jhpratt impl `Default` for `array::IntoIter` cc #91583 my personal use of this feature comes from https://github.com/fee1-dead/w/blob/092db5df631ea515b688bae99c7f02eef12d7221/src/cont.rs#L154-L170 insta-stable, but I feel like this is small enough to _not_ require an ACP (but a FCP per https://forge.rust-lang.org/libs/maintaining-std.html#when-theres-new-trait-impls)? feel free to correct me if I am wrong.
Rollup of 14 pull requests Successful merges: - rust-lang/rust#141574 (impl `Default` for `array::IntoIter`) - rust-lang/rust#141608 (Add support for repetition to `proc_macro::quote`) - rust-lang/rust#142100 (rustdoc: make srcIndex no longer a global variable) - rust-lang/rust#142371 (avoid `&mut P<T>` in `visit_expr` etc methods) - rust-lang/rust#142517 (Windows: Use anonymous pipes in Command) - rust-lang/rust#142520 (alloc: less static mut + some cleanup) - rust-lang/rust#142588 (Generic ctx imprv) - rust-lang/rust#142605 (Don't unwrap in enzyme builds in case of missing llvm-config) - rust-lang/rust#142608 (Refresh module-level docs for `rustc_target::spec`) - rust-lang/rust#142618 (Lint about `console` calls in rustdoc JS) - rust-lang/rust#142620 (Remove a panicking branch in `BorrowedCursor::advance`) - rust-lang/rust#142631 (Dont suggest remove semi inside macro expansion for redundant semi lint) - rust-lang/rust#142632 (Update cargo) - rust-lang/rust#142635 (Temporarily add back -Zwasm-c-abi=spec) r? `@ghost` `@rustbot` modify labels: rollup
cc #91583
my personal use of this feature comes from https://github.com/fee1-dead/w/blob/092db5df631ea515b688bae99c7f02eef12d7221/src/cont.rs#L154-L170
insta-stable, but I feel like this is small enough to not require an ACP (but a FCP per https://forge.rust-lang.org/libs/maintaining-std.html#when-theres-new-trait-impls)? feel free to correct me if I am wrong.