Skip to content

Ensure Send/Sync impl for std::process::CommandArgs - #155113

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Mark-Simulacrum:auto-trait-cmd
Jun 12, 2026
Merged

Ensure Send/Sync impl for std::process::CommandArgs#155113
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Mark-Simulacrum:auto-trait-cmd

Conversation

@Mark-Simulacrum

Copy link
Copy Markdown
Member

This also adds static assertions to ensure this continues to hold across all targets. I think today this was just missing on cfg(unix) targets, but haven't checked too thoroughly. I think all tier 2+ targets continue to compile with the assertions (but we'll see what CI says).

cc #154517

@Mark-SimulacrumMark-Simulacrum added T-libs-api [DEPRECATED; DO NOT USE] needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Apr 10, 2026
@rustbotrustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 10, 2026
@Mark-Simulacrum
Mark-Simulacrum marked this pull request as ready for review April 11, 2026 13:41
@rustbot

Copy link
Copy Markdown
Collaborator

@Mark-Simulacrum: no appropriate reviewer found, use r? to override

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 11, 2026
@Mark-SimulacrumMark-Simulacrum added the S-waiting-on-t-libs-api [DEPRECATED; DO NOT USE] label Apr 11, 2026
@Amanieu

Copy link
Copy Markdown
Member

@rfcbot merge libs-api

@rust-rfcbot

rust-rfcbot commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

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.

@rust-rfcbotrust-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. labels Apr 14, 2026
@the8472the8472 removed needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-t-libs-api [DEPRECATED; DO NOT USE] labels Apr 28, 2026
@rust-rfcbotrust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Apr 28, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

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

@rust-rfcbotrust-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 May 8, 2026
@rust-rfcbot

Copy link
Copy Markdown
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.

@Mark-Simulacrum

Copy link
Copy Markdown
MemberAuthor

r? libs

@rustbotrustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 11, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

Main apprehension right now is that the test is lifetime-based, which technically could fail for bad reasons if we only implemented the markers for static lifetimes, but I don't quite have in my head what the suitable alternative would be.

@Mark-Simulacrum

Copy link
Copy Markdown
MemberAuthor

Maybe it works to put for<'a> Ty<'a> there?

My feeling is that the assertions are more defense in depth than anything else though, and I think it's very unlikely we'd have a lifetime-dependent Send or Sync (or any other auto trait) implementation.

@clarfonthey

Copy link
Copy Markdown
Contributor

Oh, I agree with you there, I just think there may be a way to make it work in all cases anyway and want to try that out if we can.

Might be as simple as adding a second function intermediary which has a lifetime parameter.

@Mark-Simulacrum

Copy link
Copy Markdown
MemberAuthor

Ah, right, for<'a> Ty<'a> won't work, that syntax only works in trait bounds today. I think maybe there's some way to express the condition we want (indirecting via a trait impl, perhaps?) but I'm not personally feeling that any additional complexity is warranted here. If you can come up with a simple way to express the more general condition happy to apply it, otherwise I'm inclined to move forward as-is if you don't object.

@clarfonthey

Copy link
Copy Markdown
Contributor

To be clear, my plan was to actually do that, I just hadn't gotten around to it yet: basically, I'd like to try my hand at making a version that works so it can be useful as a template, but if I can't figure it out, I'll just merge as-is.

@clarfonthey

Copy link
Copy Markdown
Contributor

After experimenting a bit, I guess that we have explicitly ensured this can't happen:

error[E0366]: `!Send` impls cannot be specialized
--> library/std/src/process.rs:1314:1
|
1314 | impl !Send for CommandArgs<'static> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and so:

@bors r+ rollup

@rust-bors

rust-borsBot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c08e6e4 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Jun 12, 2026
@jhprattjhpratt mentioned this pull request Jun 12, 2026
rust-borsBot pushed a commit that referenced this pull request Jun 12, 2026
Rollup of 24 pull requests
Successful merges:
- #157716 (update Enzyme, June'26)
- #149793 (Add inline asm support for amdgpu)
- #155299 (make repr_transparent_non_zst_fields a hard error)
- #157612 (Add a test where subtyping inhibits coercion.)
- #157626 (Autogenerate unstable compiler flag stubs for unstable-book)
- #157667 (Rename typing modes to better describe real usage)
- #149749 (Make `BorrowedBuf` and `BorrowedCursor` generic over the data)
- #155113 (Ensure Send/Sync impl for std::process::CommandArgs)
- #156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`)
- #157342 (Reduce verbosity of cycle errors when possible)
- #157366 (Add a regression test for an unconstrained TransmuteFrom ICE)
- #157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path)
- #157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy)
- #157698 (Remove an unnecessary cloning)
- #157699 (Arg splat experiment - hir FnDecl impl)
- #157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`)
- #157722 (Move create_scope_map to rustc_codegen_ssa.)
- #157723 (Move uninhabited unreachable code lint to rustc_mir_transform)
- #157725 (Keep generic suggestion for macro-expanded missing-type items)
- #157733 (Remove old FIXMEs about nocapture attribute)
- #157737 (Reorganize `tests/ui/issues` [7/N])
- #157746 (supports_c_variadic_definitions: extend checklist for new targets)
- #157763 (Move unused target expression error to appropriate place and rename it)
- #157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
@rust-bors
rust-borsBot merged commit 70f6aab into rust-lang:mainJun 12, 2026
11 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jun 12, 2026
rust-timer added a commit that referenced this pull request Jun 12, 2026
Rollup merge of #155113 - Mark-Simulacrum:auto-trait-cmd, r=clarfonthey
Ensure Send/Sync impl for std::process::CommandArgs
This also adds static assertions to ensure this continues to hold across all targets. I think today this was just missing on cfg(unix) targets, but haven't checked too thoroughly. I think all tier 2+ targets continue to compile with the assertions (but we'll see what CI says).
cc #154517
pullBot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Jun 13, 2026
Rollup of 24 pull requests
Successful merges:
- rust-lang/rust#157716 (update Enzyme, June'26)
- rust-lang/rust#149793 (Add inline asm support for amdgpu)
- rust-lang/rust#155299 (make repr_transparent_non_zst_fields a hard error)
- rust-lang/rust#157612 (Add a test where subtyping inhibits coercion.)
- rust-lang/rust#157626 (Autogenerate unstable compiler flag stubs for unstable-book)
- rust-lang/rust#157667 (Rename typing modes to better describe real usage)
- rust-lang/rust#149749 (Make `BorrowedBuf` and `BorrowedCursor` generic over the data)
- rust-lang/rust#155113 (Ensure Send/Sync impl for std::process::CommandArgs)
- rust-lang/rust#156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`)
- rust-lang/rust#157342 (Reduce verbosity of cycle errors when possible)
- rust-lang/rust#157366 (Add a regression test for an unconstrained TransmuteFrom ICE)
- rust-lang/rust#157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path)
- rust-lang/rust#157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy)
- rust-lang/rust#157698 (Remove an unnecessary cloning)
- rust-lang/rust#157699 (Arg splat experiment - hir FnDecl impl)
- rust-lang/rust#157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`)
- rust-lang/rust#157722 (Move create_scope_map to rustc_codegen_ssa.)
- rust-lang/rust#157723 (Move uninhabited unreachable code lint to rustc_mir_transform)
- rust-lang/rust#157725 (Keep generic suggestion for macro-expanded missing-type items)
- rust-lang/rust#157733 (Remove old FIXMEs about nocapture attribute)
- rust-lang/rust#157737 (Reorganize `tests/ui/issues` [7/N])
- rust-lang/rust#157746 (supports_c_variadic_definitions: extend checklist for new targets)
- rust-lang/rust#157763 (Move unused target expression error to appropriate place and rename it)
- rust-lang/rust#157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.T-libs-api[DEPRECATED; DO NOT USE]to-announceAnnounce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@Mark-Simulacrum@rustbot@Amanieu@rust-rfcbot@clarfonthey@the8472