Repository navigation
Support inheriting jobserver when using cargo run #12597
Description
Activity
- addedC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
on Aug 30, 2023 - addedE-easyExperience: EasyExperience: EasyI-nominated-to-discussTo be discussed during issue triage on the next Cargo team meetingTo be discussed during issue triage on the next Cargo team meetingA-jobserverArea: jobserver, concurrency, parallelismArea: jobserver, concurrency, parallelismS-needs-team-inputStatus: Needs input from team on whether/how to proceed.Status: Needs input from team on whether/how to proceed.and removedS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.E-easyExperience: EasyExperience: Easy
on Aug 30, 2023 - removedI-nominated-to-discussTo be discussed during issue triage on the next Cargo team meetingTo be discussed during issue triage on the next Cargo team meeting
on Sep 26, 2023 In all cases like these cargo shouldn't close its jobserver file descriptors (or other handles), but pass them to the tool being run instead.
From what I understood in the PR, this does not seem to be what the PR does. The PR only makes it so that if cargo uses an external jobserver, that one is now propagated to
cargo runas well.So maybe the issue should be reopened?
Reacted by Weihang LoFrom reading this issue title, and the context of #10511 (comment), I made an assumption that miri (or some other tool alike) would like to inherit existing jobserver from the environment, exactly as how Cargo treats external commands today since #10511. #12776 made it so. It's my fault that didn't request more details from the issue author.
The line between compilation and execution is not always clear in cargo, like
--keep-goingflag. What is kept going, rustc or the final binary run? 🤯That said, if this doesn't resolve the miri issue, I am sorry 😞. I would suggest opening another issue to clarify the workflow and expectation, and we could consider a piped-based jobserver by default (see PR description in #12776).
Problem
Sometimes commands run through
cargo runactually perform build actions for a larger build system.For example in #10511 (comment) the scenario is running something like
cargo run -p binding_generatorwhich generates headers to be used during the build later.And in rust-lang/rust#113730 (comment) cargo-miri is set as
target.runnerand runs as a part ofcargo run(and calls build tools like cargo and rustc recursively).Proposed Solution
In all cases like these cargo shouldn't close its jobserver file descriptors (or other handles), but pass them to the tool being run instead.
I think doing this under an options would be fine.
The default for such option can be decided upon later (probably kept being false, which is equivalent to the current behavior).
Notes
No response