-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add Extend impls for tuples of arity 1 through 12 #132187
Conversation
This was discussed in #85835 (comment) and I want to get that effort started. It's been forever since I contributed to rustc, so please excuse if I did something wrong. If this is deemed OK, I would be happy to follow this up with the same treatmeant for |
r? libs-api |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@rust-lang/libs-api:
fn main() {
let iter = std::iter::repeat_n(('a', 'b', 'c'), 3);
- let mut collection = (Vec::new(), (Vec::new(), Vec::new()));
- iter.map(|(a, b, c)| (a, (b, c))).collect_into(&mut collection);
- let (va, (vb, vc)) = collection;
+ let mut collections = (Vec::new(), Vec::new(), Vec::new());
+ iter.collect_into(&mut collections);
+ let (va, vb, vc) = collections;
println!("{:?}\n{:?}\n{:?}", va, vb, vc);
} |
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. |
How so? This doesn't change |
You are right. I've updated the motivating use case to use |
This comment was marked as duplicate.
This comment was marked as duplicate.
I noticed I made a silly mistake, I added tuple impls for not just 12-tuples but 13-tuples accidentally. I am also adding some tests for these impls, but I wonder, is there a good example to verify 13-tuples do not have the Extend impl? I also want to add the FromIterator<(EA, ...)> for (A, ...) impls. Should these go into a new PR? That would enable this:
|
it would be awesome to get your opinion here, @joshtriplett @m-ou-se @BurntSushi - thanks! |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@bors r+ |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130209 (Stabilize `std::io::ErrorKind::CrossesDevices`) - rust-lang#130254 (Stabilize `std::io::ErrorKind::QuotaExceeded`) - rust-lang#132187 (Add Extend impls for tuples of arity 1 through 12) - rust-lang#133875 (handle `--json-output` properly) - rust-lang#133934 (Do not implement unsafe auto traits for types with unsafe fields) - rust-lang#133954 (Hide errors whose suggestions would contain error constants or types) - rust-lang#133960 (rustdoc: remove eq for clean::Attributes) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130209 (Stabilize `std::io::ErrorKind::CrossesDevices`) - rust-lang#130254 (Stabilize `std::io::ErrorKind::QuotaExceeded`) - rust-lang#132187 (Add Extend impls for tuples of arity 1 through 12) - rust-lang#133875 (handle `--json-output` properly) - rust-lang#133934 (Do not implement unsafe auto traits for types with unsafe fields) - rust-lang#133954 (Hide errors whose suggestions would contain error constants or types) - rust-lang#133960 (rustdoc: remove eq for clean::Attributes) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130209 (Stabilize `std::io::ErrorKind::CrossesDevices`) - rust-lang#130254 (Stabilize `std::io::ErrorKind::QuotaExceeded`) - rust-lang#132187 (Add Extend impls for tuples of arity 1 through 12) - rust-lang#133875 (handle `--json-output` properly) - rust-lang#133934 (Do not implement unsafe auto traits for types with unsafe fields) - rust-lang#133954 (Hide errors whose suggestions would contain error constants or types) - rust-lang#133960 (rustdoc: remove eq for clean::Attributes) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132187 - shahn:extend_more_tuples, r=dtolnay Add Extend impls for tuples of arity 1 through 12
No description provided.