Skip to content

Commit

Permalink
Add a comment describing why these are disallowed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed May 7, 2023
1 parent 4ec06f4 commit 2fce10d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cargo/util/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,20 @@ impl Config {
.env_config
.try_borrow_with(|| self.get::<EnvConfig>("env"))?;

// Reasons for disallowing these values:
//
// - CARGO_HOME: The initial call to cargo does not honor this value
// from the [env] table. Recursive calls to cargo would use the new
// value, possibly behaving differently from the outer cargo.
//
// - RUSTUP_HOME: Under normal usage with rustup, this will have no
// effect because the rustup proxy sets RUSTUP_HOME, and that would
// override the [env] table. If the outer cargo is executed directly
// circumventing the rustup proxy, then this would affect calls to
// rustc (assuming that is a proxy), which could potentially cause
// problems with cargo and rustc being from different toolchains. We
// consider this to be not a use case we would like to support,
// since it will likely cause problems or lead to confusion.
for disallowed in &["CARGO_HOME", "RUSTUP_HOME"] {
if env_config.contains_key(*disallowed) {
bail!(
Expand Down

0 comments on commit 2fce10d

Please sign in to comment.