Open
Description
Currently Cargo does not inspect the [env]
config table for its own environment variables. This may have been an oversight and it is not clear exactly how to proceed from here. A few options:
- Merge the
[env]
table into Cargo's environment snapshot, and make cargo honor most of the environment variables.- There are some environment variables with subtle complexities like
CARGO_HOME
andPATH
.
- There are some environment variables with subtle complexities like
- Deny (or issue a warning) if you attempt to set one of Cargo's environment variables in the
[env]
table.- Unfortunately this will be challenging, and a breaking change. There are some users already setting environment variables that start with
CARGO_
for their own purpose. Also, those environment variables will apply to recursive cargo invocations.
- Unfortunately this will be challenging, and a breaking change. There are some users already setting environment variables that start with
Related issues:
- cargo subcommands do not pick up [env] #10094: Should cargo at least set the environment for external subcommands?
- fix: make subcommands pick up [env] #10780: Attempt to forbid setting CARGO_ environment variables (among other things).