Description
Problem
There is no way to "unset"/reset to "default, the number of build jobs specified to Cargo.
Consider your team has a .cargo/config.toml
located in the root of your repository. You want to set the following:
[build]
jobs = -1
So that on all developer's machines, one core will be left available when running cargo for your computer to do other tasks.
But your CI infrastructure also runs cargo
, and you want CI to use all possible cores to makes builds as fast as possible. You can set the CARGO_BUILD_JOBS
environment variable, but via the env variable (or --jobs
cli option) but there is no way to override the number of jobs back to "default"/num cpus.
Proposed Solution
A solution is to define a new value that represents the default/num_cpus state. Two proposals would be:
- Reinterpret
0
jobs as meaning "default"
a. Today specifying0
as the number of jobs returns an error, so changing this shouldn't(?) break any flows - Add a new supported value like "d", "default", or "num_cpus" that when specified we use the default value
Personally I'd prefer option 1 as it seems like the easiest, but I'm not sure if there are any flows that rely on cargo
returning an error.
Notes
No response