Skip to content

Conversation

joboet
Copy link
Member

@joboet joboet commented Mar 21, 2025

This is an alternative to #137400. The current macro is incredibly complicated and introduces subtle bugs like calling the extend_one of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from #137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized Extend implementations of the individual collection.

@rustbot
Copy link
Collaborator

rustbot commented Mar 21, 2025

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Mar 21, 2025
@rust-log-analyzer

This comment has been minimized.

joboet and others added 2 commits March 21, 2025 21:01
This is an alternative to rust-lang#137400. The current macro is incredibly complicated and introduces subtle bugs like calling the `extend_one` of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from rust-lang#137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized `Extend` implementations of the individual collection.
ordering of side-effects to `coretest`.
@joboet
Copy link
Member Author

joboet commented Sep 18, 2025

r? libs

@rustbot rustbot assigned Mark-Simulacrum and unassigned Amanieu Sep 18, 2025
@Mark-Simulacrum
Copy link
Member

Did we land the behavior fix (extend_one mentioned in the PR description) already? Or is this a behavior change that needs cratering / FCP / etc?

The implementation itself does seem like a good simplification but presumably we'd want FCP for the behavior fix.

@joboet
Copy link
Member Author

joboet commented Sep 22, 2025

No, as far as I know this changes the behaviour. So yeah, an FCP seems warranted.
@rustbot label +I-libs-nominated

@rustbot rustbot added the I-libs-nominated Nominated for discussion during a libs team meeting. label Sep 22, 2025
@Amanieu
Copy link
Member

Amanieu commented Sep 24, 2025

We discussed this in the @rust-lang/libs meeting and we're happy with the behavior changes. We consider the 2 changes listed in #137400 (comment) to be implementation-defined behavior that was never guaranteed in the documentation.

@rfcbot merge

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Sep 24, 2025

Team member @Amanieu 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.

@Amanieu Amanieu removed the I-libs-nominated Nominated for discussion during a libs team meeting. label Sep 24, 2025
@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Sep 24, 2025
@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@rust-rfcbot rust-rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Sep 24, 2025
@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Oct 4, 2025
@rust-rfcbot
Copy link
Collaborator

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.

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 11, 2025

📌 Commit af66ece has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 11, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 12, 2025
…crum

core: simplify `Extend` for tuples

This is an alternative to rust-lang#137400. The current macro is incredibly complicated and introduces subtle bugs like calling the `extend_one` of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from rust-lang#137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized `Extend` implementations of the individual collection.
bors added a commit that referenced this pull request Oct 12, 2025
Rollup of 12 pull requests

Successful merges:

 - #138799 (core: simplify `Extend` for tuples)
 - #146692 (Save x.py's help text for saving output time)
 - #147168 (Don't unconditionally build alloc for `no-std` targets)
 - #147178 ([DebugInfo] Improve formatting of MSVC enum struct variants)
 - #147240 (Add an ACP list item to the library tracking issue template)
 - #147246 (Explain not existed key in BTreeMap::split_off)
 - #147393 (Extract most code from `define_feedable!`)
 - #147495 (Update wasm-component-ld to 0.5.18)
 - #147503 (Fix documentation of Instant::now on mac)
 - #147541 (Change int-to-ptr transmute lowering back to inttoptr)
 - #147549 (Replace `LLVMRustContextCreate` with normal LLVM-C API calls)
 - #147596 (Adjust the Arm targets in CI to reflect latest changes)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Oct 12, 2025
Rollup of 8 pull requests

Successful merges:

 - #138799 (core: simplify `Extend` for tuples)
 - #145897 (Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#4 of Batch #2])
 - #146692 (Save x.py's help text for saving output time)
 - #147240 (Add an ACP list item to the library tracking issue template)
 - #147246 (Explain not existed key in BTreeMap::split_off)
 - #147393 (Extract most code from `define_feedable!`)
 - #147503 (Fix documentation of Instant::now on mac)
 - #147549 (Replace `LLVMRustContextCreate` with normal LLVM-C API calls)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 817720c into rust-lang:master Oct 12, 2025
6 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 12, 2025
rust-timer added a commit that referenced this pull request Oct 12, 2025
Rollup merge of #138799 - joboet:extend-tuple, r=Mark-Simulacrum

core: simplify `Extend` for tuples

This is an alternative to #137400. The current macro is incredibly complicated and introduces subtle bugs like calling the `extend_one` of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from #137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized `Extend` implementations of the individual collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants